eLocal/rain — pull request #3 by tubbo (2013-03-26 18:29:55+00:00)
Title: Run commands in clean bundler env

Sometimes, Rain will fail to commit its changes to `config/versions.yml` and cause mass havoc in deployment. This was usually due to a rogue Git plugin that was using an outdated (system) version of Ruby and not included in the Gemfile (because it's not an application-level dependency). It has been fixed by wrapping all GitTools commands within a `Bundler.with_clean_env` block, which will ensure the proper Ruby and versions of each gem are loaded in as Rain is deploying.

Special thanks to @stevenharman who introduced me to this technique and @alindeman for expanding on it and providing a few extra options for running commands in a Bundler env. You guys rock!