diff options
author | MSP-Greg <MSP-Greg@users.noreply.github.com> | 2019-07-13 08:20:12 -0500 |
---|---|---|
committer | MSP-Greg <MSP-Greg@users.noreply.github.com> | 2019-07-16 13:46:09 -0500 |
commit | 537c0ab712dc0a91d10839096ecb28273292eab9 (patch) | |
tree | 552470c3efad57ba8ac5a37522ee70b26308d6e7 | |
parent | 53bc81ecdf3e4a94c25a856c3227fb94d76c1769 (diff) | |
download | bundler-537c0ab712dc0a91d10839096ecb28273292eab9.tar.gz |
fix nested bundle exec's when bundler is a default gem
-rw-r--r-- | lib/bundler/shared_helpers.rb | 10 | ||||
-rw-r--r-- | spec/bundler/shared_helpers_spec.rb | 6 |
2 files changed, 12 insertions, 4 deletions
diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb index 614e09f746..63f8d7d471 100644 --- a/lib/bundler/shared_helpers.rb +++ b/lib/bundler/shared_helpers.rb @@ -287,9 +287,15 @@ module Bundler 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 diff --git a/spec/bundler/shared_helpers_spec.rb b/spec/bundler/shared_helpers_spec.rb index 3b30a1f49f..c6e3487494 100644 --- a/spec/bundler/shared_helpers_spec.rb +++ b/spec/bundler/shared_helpers_spec.rb @@ -402,8 +402,10 @@ RSpec.describe Bundler::SharedHelpers do 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 |