Skip to content

Commit 9f961a4

Browse files
deivid-rodriguezhsbt
authored andcommitted
[rubygems/rubygems] Workaround RVM issue when using Bundler <= 2.5.22
Old versions of BUndler need a workaround to support nested `bundle exec` invocations by overriding `Gem.activate_bin_path`. However, RubyGems now uses this new `Gem.activate_and_load_bin_path` helper in binstubs, which is of course not overridden in those Bundler versions since it didn't exist at the time. So, include the override here to workaround that. ruby/rubygems@e5ed95e242
1 parent ba6a271 commit 9f961a4

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

lib/rubygems.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,13 @@ def self.activate_and_load_bin_path(name, exec_name = nil, *requirements)
298298
spec = find_and_activate_spec_for_exe name, exec_name, requirements
299299

300300
if spec.name == "bundler"
301+
# Old versions of Bundler need a workaround to support nested `bundle
302+
# exec` invocations by overriding `Gem.activate_bin_path`. However,
303+
# RubyGems now uses this new `Gem.activate_and_load_bin_path` helper in
304+
# binstubs, which is of course not overridden in Bundler since it didn't
305+
# exist at the time. So, include the override here to workaround that.
306+
load ENV["BUNDLE_BIN_PATH"] if ENV["BUNDLE_BIN_PATH"] && spec.version <= "2.5.22"
307+
301308
# Make sure there's no version of Bundler in `$LOAD_PATH` that's different
302309
# from the version we just activated. If that was the case (it happens
303310
# when testing Bundler from ruby/ruby), we would load Bundler extensions

0 commit comments

Comments
 (0)