Permalink
Browse files

Revert "bundle exec does less work"

Based on reports from Piotr Sarnacki, this commit breaks BUNDLE_BIN_PATH when you run e.g. `bundle exec bundle -v`. Reverting to stabilize master while we investigate and hopefully fix.

This reverts commit f96d7e7.
  • Loading branch information...
1 parent 5ba2081 commit a18e76f9e945b986e80f8405e599bab2e9ad7d89 @indirect indirect committed May 27, 2012
View
@@ -216,31 +216,6 @@ def clean_exec(*args)
with_clean_env { Kernel.exec(*args) }
end
- def setup_environment
- begin
- ENV["BUNDLE_BIN_PATH"] = Bundler.rubygems.bin_path("bundler", "bundle", VERSION)
- rescue Gem::GemNotFoundException
- ENV["BUNDLE_BIN_PATH"] = File.expand_path("../../../bin/bundle", __FILE__)
- end
-
- # Set PATH
- paths = (ENV["PATH"] || "").split(File::PATH_SEPARATOR)
- paths.unshift "#{Bundler.bundle_path}/bin"
- ENV["PATH"] = paths.uniq.join(File::PATH_SEPARATOR)
-
- # Set BUNDLE_GEMFILE
- ENV["BUNDLE_GEMFILE"] = default_gemfile.to_s
-
- # Set RUBYOPT
- rubyopt = [ENV["RUBYOPT"]].compact
- if rubyopt.empty? || rubyopt.first !~ /-rbundler\/setup/
- rubyopt.unshift "-rbundler/setup"
- rubyopt.unshift "-I#{File.expand_path('..', __FILE__)}"
- ENV["RUBYOPT"] = rubyopt.join(' ')
- end
- end
-
-
def default_gemfile
SharedHelpers.default_gemfile
end
View
@@ -419,7 +419,8 @@ def package
def exec(*)
ARGV.shift # remove "exec"
- Bundler.setup_environment
+ Bundler.definition.validate_ruby!
+ Bundler.load.setup_environment
ENV['BUNDLE_EXECING'] = options["no-color"] ? "no-color" : "color"
View
@@ -201,7 +201,27 @@ def clean
end
def setup_environment
- Bundler.setup_environment
+ begin
+ ENV["BUNDLE_BIN_PATH"] = Bundler.rubygems.bin_path("bundler", "bundle", VERSION)
+ rescue Gem::GemNotFoundException
+ ENV["BUNDLE_BIN_PATH"] = File.expand_path("../../../bin/bundle", __FILE__)
+ end
+
+ # Set PATH
+ paths = (ENV["PATH"] || "").split(File::PATH_SEPARATOR)
+ paths.unshift "#{Bundler.bundle_path}/bin"
+ ENV["PATH"] = paths.uniq.join(File::PATH_SEPARATOR)
+
+ # Set BUNDLE_GEMFILE
+ ENV["BUNDLE_GEMFILE"] = default_gemfile.to_s
+
+ # Set RUBYOPT
+ rubyopt = [ENV["RUBYOPT"]].compact
+ if rubyopt.empty? || rubyopt.first !~ /-rbundler\/setup/
+ rubyopt.unshift "-rbundler/setup"
+ rubyopt.unshift "-I#{File.expand_path('../..', __FILE__)}"
+ ENV["RUBYOPT"] = rubyopt.join(' ')
+ end
end
private
View
@@ -2,12 +2,8 @@ module Bundler
class Settings
def initialize(root)
@root = root
-
- local_config_exists = File.exists?(local_config_file) && File.size(local_config_file).nonzero?
- @local_config = (local_config_exists && yaml = YAML.load_file(local_config_file)) ? yaml : {}
-
- global_config_exists = File.exists?(global_config_file) && File.size(global_config_file).nonzero?
- @global_config = (global_config_exists && yaml = YAML.load_file(global_config_file)) ? yaml : {}
+ @local_config = (File.exist?(local_config_file) && yaml = YAML.load_file(local_config_file)) ? yaml : {}
+ @global_config = (File.exist?(global_config_file) && yaml = YAML.load_file(global_config_file)) ? yaml : {}
end
def [](key)
@@ -315,34 +315,27 @@
end
it "doesn't blow up when the local .bundle/config is empty" do
- config_file = bundled_app(".bundle/config")
FileUtils.mkdir_p(bundled_app(".bundle"))
- FileUtils.touch(config_file)
+ FileUtils.touch(bundled_app(".bundle/config"))
install_gemfile(<<-G, :exitstatus => true)
source "file://#{gem_repo1}"
gem 'foo'
G
exitstatus.should == 0
- File.exists?(config_file).should be_true
- File.size(config_file).should be_zero
end
it "doesn't blow up when the global .bundle/config is empty" do
- config_file = "#{Bundler.rubygems.user_home}/.bundle/config"
FileUtils.mkdir_p("#{Bundler.rubygems.user_home}/.bundle")
- FileUtils.touch(config_file)
+ FileUtils.touch("#{Bundler.rubygems.user_home}/.bundle/config")
install_gemfile(<<-G, :exitstatus => true)
source "file://#{gem_repo1}"
gem 'foo'
G
-
exitstatus.should == 0
- File.exists?(config_file).should be_true
- File.size(config_file).should be_zero
end
end
@@ -25,20 +25,6 @@
it_should_behave_like "Bundler.with_*_env"
- it "should keep the original GEM_PATH even in sub processes" do
- gemfile ""
- bundle "install --path vendor/bundle"
-
- gem_path = ENV['GEM_PATH']
-
- code = "Bundler.with_clean_env do;" +
- " print ENV['GEM_PATH'] != '';" +
- "end"
-
- result = bundle "exec ruby -e #{code.inspect}"
- result.should == "true"
- end
-
it "should not pass any bundler environment variables" do
Bundler.with_clean_env do
`echo $BUNDLE_PATH`.strip.should_not == './Gemfile'

0 comments on commit a18e76f

Please sign in to comment.