Fixing Rails 3 Beta ‘Invalid .gemspec format’ Errors

February 7th, 2010 by admin Leave a reply »

If you’ve tried out Rails 3 on Ruby 1.9.1 (like myself) you might of noticed that a lot of errors are being sent to stderr, it’ll look something like this:

Ozawa Sakuro has posted a fix for this on GitHub.  You can see the original thread here, or simply follow the directions below to quickly fix it without trolling through the entire discussion:

1.  Edit lib/bundler.rb:

4: require 'bundler/rubygems-ext'  # originally 'bundler/rubygems'

2. Next rename lib/bundler/rubygems.rb to rubygems-ext.rb and then edit the file and wrap the require in a control structure as shown below:

1: unless defined? Gem
2:   require 'rubygems'
3:   require 'rubygems/specification'
4: end

I’ve tested this fix and it works with Bundler 0.9.3.  Version 0.9.4 resolves the issue (thanks for the update Christian).  In any event I hope this little nugget of information helps reduce the hair pulling.

Advertisement

2 comments

  1. jdv says:

    Thank you for this summary. I left a comment about it in Railscasts#200, maybe Ryan will spread it out ;)

  2. The bugfix release of bundler was just released … so do an update gem and get bundler 0.9.4 which solves the error :-)

Leave a Reply