Rails 3 & freezing gems

I learned an important lesson today. The quick summary is “bundler makes freezing gems unnecessary, use ‘bundle install –deployment‘”. But for those who like a good, geeky story:

I’ve been updating/upgrading/refactoring a Rails 2 project as a Rails 3 project. We’d used the method described here to ensure that developer, testing & production environments would be synched with regards to gems, particularly Rails itself.

Rails 3 introduces the use of bundler, a sweet gem management tool. In a googling of “rails 3 freeze gems” I came across a post on Stack Overflow describing a bundle option to set the BUNDLE_PATH variable.  I ran it and voila: all my gems were in the vendor/gems folder.  Seemed to do the trick.

When trying in vain to get the app building in Hudson, I came to realize that the –path option had not worked.  Instead, using ‘bundle install –deployment’ on the hudson machine (vs sending it all the gems as part of a Git checkout) was the REAL trick.

The moral of the story: don’t believe everything you read on the internet and RTFM.

Comments are closed.