Skip to content

Instantly share code, notes, and snippets.

@mkb
Created August 2, 2011 06:27
Show Gist options
  • Save mkb/1119690 to your computer and use it in GitHub Desktop.
Save mkb/1119690 to your computer and use it in GitHub Desktop.
Using an unreleased gem version with Bundler

TL;DR

Do this:

gem 'nokogiri'
gem 'w3c_validators', "1.1.1", :git => 'git://github.com/alexdunae/w3c_validators.git'

Why?

After experiencing trouble with the w3c_validators gem, I discovered that the problem was a known bug. A fix has been committed, but not yet released in gem form. I could have gone with an older version of the gem, but instead tweaked my Gemfile (ie, Bundler) to use the latest and greatest code.

I added a :git argument to my Gemfile, instructing bundler to grab the w3c_validators gem straight from the GitHub repo, bypassing rubygems.org.

gem 'w3c_validators', :git => 'git://github.com/alexdunae/w3c_validators.git'

This turned out not to work:

Could not find gem 'w3c_validators (>= 0, runtime)' in 
git://github.com/alexdunae/w3c_validators.git (at master).
Source does not contain any versions of 'w3c_validators (>= 0, runtime)'

The code was present, but the latest revision lacks a gemspec. To work around this, Bundler needs to know what version number to use for the code it pulls down:

gem 'w3c_validators', "1.1.1", :git => 'git://github.com/alexdunae/w3c_validators.git'

KABLAM. Still not quite right. Without a gemspec, Bundler has no way of knowing that w3c_validators depends on nokogiri, so we must state the dependency explicitly:

gem 'nokogiri'
gem 'w3c_validators', "1.1.1", :git => 'git://github.com/alexdunae/w3c_validators.git'

And then there was much rejoicing throughout the land.

RTFM

http://gembundler.com/git.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment