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

[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
This commit is contained in:
David Rodríguez 2021-12-12 20:43:09 +01:00 committed by git
parent 72db2e00d4
commit 1976b38f7a

View file

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