Thursday, May 13, 2010

Rails 3, Gems, Rake and Bundler

I ran into a bit of a mystery the other day. I have a new rails 3 (beta3) install.

I'm using Jeweler to build a new gem using Rake. When I install the gem using Rake all goes along as expected. If I go to the command line and type gem list. My gem does not show up. After digging around I found that the gem is getting installed into the ~/.bundler gem location.

If I run gem commands from the terminal then GEM_HOME is as I set it.If I run gem commands from inside Rake (for my Rails 3 project that has had bundler install run on it) then it is using ~/.bundler/.. as the root of GEM_HOME.

As a result I have a gem that i need to install and re-install a lot. So I have to execute the gem uninstall commands from inside Rake.