Sean’s Obsessions


  • I'm a happy Linode customer. This is a Linode 540 VPS. Linode periodically increases RAM and disk while keeping costs steady, which makes them the natural choice.
  • Archives

21 Oct

Moving from github to gemcutter for your rails app’s gems

Much hoopla has been made over Github stopping their gem building service, and for people to use Gemcutter.

All the stuff I’ve read has been that gemcutter is much better for publishing Gems, and that it’s easier to find the canonical gem (instead of deciding whether fred-mygem is better than barney-mygem)

Fair enough, but what about slobs like me that haven’t had to modify gems, and just want to start using the new source for gems and to update existing apps accordingly?

Turns out, it’s pretty easy.

# Update gem to at least 1.3.5
gem update --sytem
# install gemcutter
gem install gemcutter
# update gem sources
gem tumble

If you look at ~/.gemrc, you’ll see that github has been pushed to the end:

---
:benchmark: false
:verbose: true
gem: --no-ri --no-rdoc
:update_sources: true
:sources:
- http://gemcutter.org
- http://gems.rubyforge.org/
- http://gems.github.com
:bulk_threshold: 1000
:backtrace: false

The last thing to do is to reinstall the old github gems using their new names. In environment.rb and environments/*.rb, look for your config.gem lines:

config.gem "thoughtbot-factory_girl",
       :lib     => 'factory_girl',
       :source  => 'http://gems.github.com'

Becomes:

config.gem "factory_girl"

Note that all you’re doing is taking off the owner of the gem, and then getting rid of the extra parameters.

It would be wise to first make sure that the gem is available on gemcutter. Browse to http://gemcutter.org/gems/GEMNAME, (eg http://gemcutter.org/gems/factory_girl) to see if you get an error.

Finally, run

rake gems:install

from within your app’s directory to install the new gems.

Presto! It’s easier than I thought.

Leave a Reply

© 2012 Sean’s Obsessions | Entries (RSS) and Comments (RSS)

Powered by Wordpress, design by Web4Sudoku, based on Pinkline byGPS Gazette