Bundler update, they grow up so fast!

Recently I wrote a post about using bundler, well so much has changed since then I thought we needed a little update.

Firstly, we’re now using bundler 0.9.7, so you need to remove the old bundler and install the new one

gem uninstall bundler

gem install bundler -v 0.9.7

The new bundler installs the files it needs from different places, so you’ll need to edit your gitignore files and remove the old structure from your app. (Make sure you haven’t put anything in bin that is not connected with bundler, you’ll need to keep that if you have)

rm -rf bin

rm -rf vendor/bundler_gems

All you need to add to .gitignore is .bundle

The gemfile has changed alot, you’ll need to check the documentation on the github site for all the specifics, but here’s our new one if you need a start.  Sample Gemfile

How you incorporate bundler into your app has also changed, and it also depends on what version of rails you are running.  For this project, we’re still on rails 2.3.5, so this is what you need to do.

Running bundler has changed as well, you used to run things like gem bundle, now you run bundle install, bundle lock, etc etc.  We’ve locked out project down so after a pull from the repo you have to run bundle install –relock to get all you new code and relock the app.  (This is going to change shortly to just having to run bundle install I think, waiting to see what happens with that one.)

And last, but not least, the new bundler has the ability to run the binaries from the gems it uses via a new command

bundle exec (rails binary)

e.g. bundle exec cucumber

This will ensure that you are using the binary from the gem you have installed via bundler, pretty neat.

There’ll be more updates as soon as we get time to update, bundler is already on 0.9.10 so expect one soon.  I got some teething troubles with the newest version on deploy so we’re holding fire on upgrading until I can work out what went wrong.

Happy bundling everyone.