Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

The top-level Rakefile requires Bundler awareness. #22

Merged
merged 1 commit into from

3 participants

@halostatue

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.

Austin Ziegler 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.
62fa3d2
@halostatue

See Issue #21

@halostatue halostatue referenced this pull request from a commit
Austin Ziegler Support for alternate binstubs.
When using more than one ruby, "bundle install --binstubs" will
continually be overwriting the binstubs put into bin/.

This patch builds on request #22 (Rakefile bundler awareness) and makes
it possible to specify an alternative binstub directory at install and
run-time. If using an alternative binstub directory, you can't run the
tests with the :default task anymore, you need to use :runtests[rake] to
specify which rake will be called (e.g., jruby-bin/rake if you used
:setup[jruby-bin]).
39b5129
@justinko justinko merged commit 3826d17 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 25, 2011
  1. The top-level Rakefile requires Bundler awareness.

    Austin Ziegler authored
    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.
This page is out of date. Refresh to see the latest.
Showing with 10 additions and 1 deletion.
  1. +10 −1 Rakefile
View
11 Rakefile
@@ -2,6 +2,8 @@ require 'rake'
require 'fileutils'
require 'pathname'
+UsingBundler = !!ENV['BUNDLE_GEMFILE']
+
Projects = ['rspec-expectations', 'rspec-mocks', 'rspec-core', 'rspec', 'rspec-rails']
BaseRspecPath = Pathname.new(Dir.pwd)
ReposPath = BaseRspecPath.join('repos')
@@ -177,7 +179,14 @@ end
task :setup => ["git:clone", "bundle:install"]
task :default do
- run_command 'rake'
+ if UsingBundler
+ Bundler.with_clean_env do
+ ENV.delete 'BUNDLE_GEMFILE'
+ run_command 'bin/rake'
+ end
+ else
+ run_command 'rake'
+ end
end
task :authors do
Something went wrong with that request. Please try again.