For those of you who follow this sort of thing, Github shut down their gem building. Thankfully, a newer and easier gem hoster, Gemcutter, appeared on the scene not long before that happened. The idea behind it, for those who haven’t heard of it, is that you manage your own gem building. Gemcutter doesn’t wait for your Gem spec to change before it makes a new gem. You simply build it locally, and push it to Gemcutter, using a handy gem they provide that extends Rubygems ‘gem’ console command.
But Github was building gems for some time, and due to it’s continuing popularity, many well known Ruby on Rails developers and companies switched permanently to Github for their gem building/hosting at the time, so it’s likely that quite a few gems you’ve got installed are from Github.
To help transition over from Github to Gemcutter, Maxim Chernyak wrote a great utility called off_github, which looks at your list of gems, and tells you which ones you’re installed from Github, and whether they can be reinstalled from Gemcutter. It saves a lot of time and effort than having to do it manually. So here’s how to get started….
Firstly, lets get the latest version of Rubygems. This may not be needed for the off_github gem to function, but it pays to keep this up to date to prevent any issues with newer gems. Usually, you’ll want Rubygems version 1.3.0 or higher. At the time of this post, the current version is 1.3.5.
$ gem –version
$ [sudo] gem update –system
$ gem –version
Once that’s done, install the off_github gem. To do that, add Gemcutter as a source and run the gem install command.
$ gem sources -a http://gemcutter.org
$ [sudo] gem install off_github
Note: Rubyforge gems now points to Gemcutter, so the gem source adding isn’t technically needed to install off_github. That said, the off_github gem still checks for the Gemcutter source (it’s a bit outdated) and won’t work without it, so to get around it, install it before running, and you can remove it afterwards.
Now go ahead and run the off_github command. If you don’t use sudo to install gems, then be sure to add –no-sudo the end.
$ off_github [--no-sudo]
This’ll go ahead and return a list of gems that were installed from Github, what there Gemcutter gem name is, and the action it’ll take on that gem (usually reinstall). It’ll then ask you if you want to install. Type ‘Y’, hit enter, and then choose y/n/a at each prompt.
If everything went smoothly, you’re all done. You can now go ahead and delete both the Github and Gemcutter sources.
$ gem sources -r http://gems.github.com
$ gem sources -r http://gemcutter.org
So know, you should have Rubyforge as your only gem source.
$ gem sources
*** CURRENT SOURCES ***