1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[bundler/bundler] fix nested bundle exec's when bundler is a default gem

https://github.com/bundler/bundler/commit/537c0ab712
This commit is contained in:
MSP-Greg 2019-07-13 08:20:12 -05:00 committed by Hiroshi SHIBATA
parent 24062bd323
commit 432285c004
No known key found for this signature in database
GPG key ID: F9CF13417264FAC2
2 changed files with 12 additions and 4 deletions

View file

@ -286,9 +286,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

View file

@ -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