Ruby Flare

Your awesome Tagline

0 notes

Bundle the bleeding edge

In developing a new Rails 3 app I’ve regularly come across situations where a bug exists or a feature is missing in the latest official version of a gem. Often a fix is in the works, either in a branch or waiting in a pull request. Sometimes, I’ve made the patch and whilst waiting for my change to be pulled, I need to reference my change. To do this with gem bundler you can modify your Gemfile to reference the appropriate git repository or branch specifically. Here’s some examples:

Comment out the original gem reference and add a minimum version number:

# gem 'devise_ldap_authenticatable', '> 0.4.6'

You can specify the latest HEAD available in the gem’s git repo:

gem 'devise_ldap_authenticatable', 
  :git => 'git://github.com/cschiewek/devise_ldap_authenticatable.git'

Or you can specify a particular branch of that repo:

gem 'devise_ldap_authenticatable',
  :git => 'git://github.com/cschiewek/devise_ldap_authenticatable.git',
  :branch => 'group_attribute'

Or a particular tag:

gem 'devise_ldap_authenticatable', 
  :git => 'git://github.com/cschiewek/devise_ldap_authenticatable.git', 
  :tag => '0.4.7'

Or a particular ref (make sure to use the SHA of the tree and not the commit):

gem 'devise_ldap_authenticatable', 
  :git => 'git://github.com/cschiewek/devise_ldap_authenticatable.git', 
  :ref => '2679430ae3f3e23ce25be164fe76a370e2bd0222'

You can also specify a particular fork along with an optional branch/tag/ref:

gem 'devise_ldap_authenticatable', 
  :git => 'git://github.com/ruprict/devise_ldap_authenticatable.git'

And finally, remember to update your installed bundle with:

bundle update devise_ldap_authenticatable

Now all I need is some mechanism that automatically tells me when the change has been pulled into the official gem or at least informs me when there is a newer version of the official gem.

(Source: gembundler.com)

Filed under bundler gems