Ruby Gem update issue
Today I have decided to update my Ruby Gem software from version 0.9.5 to 1.0.1. I have previously updated my Rails from version 1.2.3 to 1.2.6. And since my Ruby Gem is a couple of version behind, I thought I should do the same. It is a straight forward process that involves just one command line. (on my Ubuntu installation) Simple enough.
After the update I got an error message that says
/usr/bin/gem:23: uninitialized constant Gem::GemRunner (NameError)
Darn. Did I break my Ruby Gem by doing the update. Thankfully the Google Search came to the rescue. Apparently from Gem 0.9.5, GemRunner is no longer automatically required by Rubygems. Don't know what the implication of this but it caused the breakdown. So to resolved that , I have to do the followings:
- Go to /usr/bin
- Edit the file called gem. I used sudo nano gem
- include this line: require ‘rubygems/gem_runner’ after the line require 'rubygems'
- Save the changes
And the Gem command works fine after that. No more uninitialize error message.
Apparently this error also occurs when issuing rake:freeze:gems command. There is a fix for that which require adding the same line of code in the file framework.rake, which can be found in the directory $GEM-HOME/gems/rails-1.2.6/lib/tasks/framework.rake
The code snippet in framework.rake should look like this:
require 'rubygems'
require 'rubygems/gem_runner'
Gem.manage_gems
Post new comment