Thursday, May 5, 2011

Rails 2.3x and Gem Hell

Today I hit up against two of my favorite problems in Rails 2.3x, or maybe both at once. This is a play by play with no additional info. It's mostly here for me, but if someone else finds it useful, great. The reason that I need to document most of this is that my brilliant coworker, Sean, fed me a lot of the lines here. 

First error: the Rails install was 2.3.8 and on deploy to the server the message was:

uninitialized constant ActiveSupport::Dependencies::Mutex

Which led me to this post on SO. So my choices were two: either upgrade the Rails installation or downgrade my rubygems system.

I opted for upgrading Rails, of course.

sudo gem install rails --version=2.3.11

I updated the environment.rb, deleted the vendorized version of Rails and tried to vendorize the new one:

rake rails:freeze:gems

Could not vendor with problem:

undefined method `version_requirements' for #<Gem::Dependency:0x10055b0d0>

To fix this, I needed to follow the instructions here, which were basically 

gem install rubygems-update -v='1.4.2'

gem uninstall rubygems-update -v='1.5.0'


However, at this point I had already screwed up my RubyGems by doing a 

sudo gem update --system

and I ended up at 1.8.0 with a whole bunch of deprecation warnings and intermediate versions of RubyGems. So first I had to uninstall all the unwanted versions. So I listed them:

 gem list | grep rubygems

and then proceded to run gem uninstall rubygems-update -v='1.x.x' on each except the last one. Then I followed the three lines above. 

This allowed me to vendorize the right Rails version and I was cooking, just 35 minutes later. Well, really 70 person-minutes later, at least. Thanks Sean!

No comments: