Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Fix nested bundle exec's when bundler is a default gem #7248

Merged
1 commit merged into from Jul 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 8 additions & 2 deletions lib/bundler/shared_helpers.rb
Expand Up @@ -287,9 +287,15 @@ def set_env(key, value)
public :set_env

def set_bundle_variables
# bundler exe & lib folders have same root folder, typical gem installation
exe_file = File.expand_path("../../../exe/bundle", __FILE__)
# for Ruby core repository
exe_file = File.expand_path("../../../../bin/bundle", __FILE__) unless File.exist?(exe_file)

# for Ruby core repository testing
exe_file = File.expand_path("../../../bin/bundle", __FILE__) unless File.exist?(exe_file)

# bundler is a default gem, exe path is separate
exe_file = Bundler.rubygems.bin_path("bundler", "bundle", VERSION) unless File.exist?(exe_file)

Bundler::SharedHelpers.set_env "BUNDLE_BIN_PATH", exe_file
Bundler::SharedHelpers.set_env "BUNDLE_GEMFILE", find_gemfile.to_s
Bundler::SharedHelpers.set_env "BUNDLER_VERSION", Bundler::VERSION
Expand Down
6 changes: 4 additions & 2 deletions spec/bundler/shared_helpers_spec.rb
Expand Up @@ -402,8 +402,10 @@

it "sets BUNDLE_BIN_PATH to the bundle executable file" do
subject.set_bundle_environment
bundle_exe = ruby_core? ? "../../../../../bin/bundle" : "../../../exe/bundle"
expect(ENV["BUNDLE_BIN_PATH"]).to eq(File.expand_path(bundle_exe, __FILE__))
bundle_exe = ruby_core? ? "../../../bin/bundle" : "../../../exe/bundle"
bin_path = ENV["BUNDLE_BIN_PATH"]
expect(bin_path).to eq(File.expand_path(bundle_exe, __FILE__))
expect(File.exist?(bin_path)).to be true
end
end

Expand Down