The top-level Rakefile requires Bundler awareness. #22

Merged
merged 1 commit into from Mar 13, 2012

Conversation

Projects
None yet
3 participants

When running the bin/rake Bundler binstub, the binstub sets ENV['BUNDLE_GEMFILE'] which is inherited by calls to the rake environments of the Projects. The top level Gemfile only includes Rake and Thor, so it's not surprising that the builds can't continue. MRI 1.9.2 appears to be able to work around this with "export RUBYOPT=rubygems", but that seems inelegant at best.

This change determines if the Rakefile was launched through a bundled rake; if so, it uses Bundler.with_clean_env (and deletes the BUNDLE_GEMFILE for good measure; necessary if you use the binstub, less necessary if you use "bundle exec rake") and instead of running 'rake', it runs 'bin/rake' to force the use of the Project rake binstub, forcing the use of the correct Gemfile and bundler environment.

The non-bundler path works as it always has.

The top-level Rakefile requires Bundler awareness.
When running the bin/rake Bundler binstub, the binstub sets
ENV['BUNDLE_GEMFILE'] which is inherited by calls to the rake
environments of the Projects. The top level Gemfile only includes Rake
and Thor, so it's not surprising that the builds can't continue. MRI
1.9.2 appears to be able to work around this with "export
RUBYOPT=rubygems", but that seems inelegant at best.

This change determines if the Rakefile was launched through a bundled
rake; if so, it uses Bundler.with_clean_env (and deletes the
BUNDLE_GEMFILE for good measure; necessary if you use the binstub, less
necessary if you use "bundle exec rake") and instead of running 'rake',
it runs 'bin/rake' to force the use of the Project rake binstub, forcing
the use of the correct Gemfile and bundler environment.

The non-bundler path works as it always has.

See Issue #21

vrish88 commented Mar 6, 2012

👍

justinko added a commit that referenced this pull request Mar 13, 2012

Merge pull request #22 from halostatue/bundle-aware-rakefile
The top-level Rakefile requires Bundler awareness.

@justinko justinko merged commit 3826d17 into rspec:master Mar 13, 2012

Contributor

justinko commented Mar 13, 2012

Thanks @halostatue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment