Monday, January 17, 2011

Different Shades of Grey

I just spent some time finishing cleaning up my gemsets, and re-installing Bundler, per my earlier posting about using RVM.  In all, I have three distinct Rails applications set up in my workspace right now, each with a slight variation on the technology stack:
  1. Rails 3 and Ruby 1.9.2 
  2. Rails 3.x and Ruby 1.8.7 and Hobo 1.0.3
  3. Rails 2.3.5 and Ruby 1.8.7 and Hobo 1.0.2
Using the "put everything in @global" approach worked OK for (1) alone, but when (2) and especially (3) came along, Bundler got downright confused about which Rails to run even though it knew which one was supposed to have been installed and which version was called out in the Gemfile. 

Two failure modalities were found. First, even though the Ruby version-specific global gemsets had been emptied, the 1.8.7 global gemset had inadvertently been repopulated by an errant bundle install.  Second, neither that gemset nor the app-specific gemset contained the Bundler gem itself, which had been silently "adopted" from the enclosing (system wide) environment.  

The solution was to reset... go back and clear out the gemsets like I had before, and this time make sure the app-specific gemset had been properly selected before running gem install bundler and then bundle install. 

Incidentally, how you start the server depends, but it seems that there are at least two ways :
  • script/server
  • rails server
I guess I don't know enough about the blessed way of Ruby server zen, but it certainly wasn't obvious by looking at the files sitting in the local directory. 

No comments: