ruby-changes:70331
From: David <ko1@a...>
Date: Mon, 20 Dec 2021 07:43:09 +0900 (JST)
Subject: [ruby-changes:70331] 1976b38f7a (master): [rubygems/rubygems] Add support in binstubs for trampolining bundler
https://git.ruby-lang.org/ruby.git/commit/?id=1976b38f7a From 1976b38f7a4e1884852653508ec1160c8b581363 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@r...> Date: Sun, 12 Dec 2021 20:43:09 +0100 Subject: [rubygems/rubygems] Add support in binstubs for trampolining bundler If `bundler _<version>_` 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 8e3965ef92d..ab09c182805 100644 --- a/lib/rubygems/installer.rb +++ b/lib/rubygems/installer.rb @@ -768,7 +768,7 @@ str = ARGV.first https://github.com/ruby/ruby/blob/trunk/lib/rubygems/installer.rb#L768 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 https://github.com/ruby/ruby/blob/trunk/lib/rubygems/installer.rb#L791 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.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/