Something is installing Rake 0.9.0 when I `bundle install`

Ran into a problem where something was installing rake v0.9.0 into my gemset when I ran bundle install. I really had no idea where this was coming from, just before I had:

*** LOCAL GEMS ***

bundler (1.0.13)
rake (0.8.7)

and after running bundle I would get:

*** LOCAL GEMS ***

rake (0.9.0, 0.8.7)

This caused various problems, which can be seen here (general) and here (Rails 3).

My problem was slightly different than those, in that even after specifying:

gem 'rake', '0.8.7'

I would still get the problem. I figured that some gem that I was installing with bundler was installing the 0.9.0 rake gem. Since I didn’t know exactly what gem was installing it, and didn’t have any better way of debugging this (if you know a way, please let me know), I wrote up a script that continually polled for my installed gems:

while true
  sleep 1
  `gem list >> 1.txt`
  `echo '' >> 1.txt`

I then reset my environment, ran bundle, ran this script in another terminal tab, and ran tail -f 1.txt in another. This way, I could see approximately when the offending rake 0.9 installation happened. After bundle ran, I killed all of the scripts and tails, and looked in the text file to see when the first time rake 0.9 was introduced. I compared it to the gem list output directly prior, and got this diff:

< rake (0.8.7)
> rake (0.9.0, 0.8.7)
> spork (0.8.4)

Aha! After some finagling (read: deleting the spork gem for now), I get things working correctly.

For awhile, I considered just deleting the rake 0.9 gem whenever I did bundle install, but this was hacky. It caused problems when I built on Hudson and when I pushed to Heroku. So I just figured I’d write up the process of figuring out how to solve this since I thought it was interesting and might be of use in the future when you don’t know of a debugging tool that will allow you to see inside of an opaque process. Plus, there might be other gems out there that do the same thing. I’m not sure why this version of spork was causing a problem, but figuring this out would be helpful.

EDIT 20110622 - the spork gem has been fixed (as of May 26th)

Categories: development

« April 2011 Customer Discovery Day Ruby Filter Script »