From 1976b38f7a4e1884852653508ec1160c8b581363 Mon Sep 17 00:00:00 2001 From: David Rodríguez Date: Sun, 12 Dec 2021 20:43:09 +0100 Subject: [rubygems/rubygems] Add support in binstubs for trampolining bundler If `bundler __` is given, I guess the most reasonable approach is to completely skip version switching, because the user is technically opting out of it. But since binstubs completely remove this argument from `ARGV` after processing it, we have no way of detecting that it was actually passed in the first place in order to skip the feature. So we set `BUNDLER_VERSION` explicitly in this case. https://github.com/rubygems/rubygems/commit/e0f360d6d7 --- lib/rubygems/installer.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb index 8e3965ef92..ab09c18280 100644 --- a/lib/rubygems/installer.rb +++ b/lib/rubygems/installer.rb @@ -768,7 +768,7 @@ str = ARGV.first if str str = str.b[/\\A_(.*)_\\z/, 1] if str and Gem::Version.correct?(str) - version = str + #{explicit_version_requirement(spec.name)} ARGV.shift end end @@ -791,6 +791,16 @@ Gem.use_gemdeps TEXT end + def explicit_version_requirement(name) + code = "version = str" + return code unless name == "bundler" + + code += <<-TEXT + + ENV['BUNDLER_VERSION'] = str +TEXT + end + ## # return the stub script text used to launch the true Ruby script -- cgit v1.2.3