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.

sudo gem update --system

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:

deps = %w(actionpack activerecord actionmailer activesupport actionwebservice)
require 'rubygems'
require 'rubygems/gem_runner'
Gem.manage_gems

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
3 + 1 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.