diff options
| author | Bundlerbot <bot@bundler.io> | 2019-05-12 14:23:05 +0000 |
|---|---|---|
| committer | Bundlerbot <bot@bundler.io> | 2019-05-12 14:23:05 +0000 |
| commit | 97c8e428318c6dab46ccef5c00d4c096d31d41fe (patch) | |
| tree | 6e9156e75788ed3f68185254657ca93e932d182b /lib/bundler/shared_helpers.rb | |
| parent | c9207d3e27f24f22279873de7257e41de9f9eed5 (diff) | |
| parent | c675b59e8f7e3b4102cf0e83598b4df23691f209 (diff) | |
| download | bundler-97c8e428318c6dab46ccef5c00d4c096d31d41fe.tar.gz | |
Merge #7062
7062: Remove version overwriting hacks r=deivid-rodriguez a=deivid-rodriguez
### What was the end-user problem that led to this PR?
The problem was that we are doing some hacks in our version file that are... dangerous. At very least they cause "circular problems" like #6927, but I also have bad feelings about it.
### What was your diagnosis of the problem?
My diagnosis was we're overwriting the version of the currently loaded bundler :grimacing:. This hack is _almost_ unnecessary (see the spec run here with the hack fully removed: https://travis-ci.org/bundler/bundler/builds/509497021. Only three jobs failed, and for old rubies/rubygems/bundler).
### What is your fix for the problem, implemented in this PR?
My fix is to limit the hack to `bundler`'s spec run, since it's only needed there.
### Why did you choose this fix out of the possible options?
I chose this fix because fully getting the build green with the hack fully removed is a bit of work. I dedicated a bit of time to investigate one of the failures and it all comes down to the priority of loading default gems vs `-I`. So I think something like https://github.com/rubygems/rubygems/pull/1868 should fix it. But that's out of the scope of this PR.
Closes #6927.
Co-authored-by: David RodrÃguez <deivid.rodriguez@riseup.net>
Diffstat (limited to 'lib/bundler/shared_helpers.rb')
| -rw-r--r-- | lib/bundler/shared_helpers.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb index e56a44a559..da2a384d29 100644 --- a/lib/bundler/shared_helpers.rb +++ b/lib/bundler/shared_helpers.rb @@ -291,8 +291,9 @@ module Bundler def set_rubyopt rubyopt = [ENV["RUBYOPT"]].compact - return if !rubyopt.empty? && rubyopt.first =~ %r{-rbundler/setup} - rubyopt.unshift %(-rbundler/setup) + setup_require = "-r#{File.expand_path("setup", __dir__)}" + return if !rubyopt.empty? && rubyopt.first =~ /#{setup_require}/ + rubyopt.unshift %(#{setup_require}) Bundler::SharedHelpers.set_env "RUBYOPT", rubyopt.join(" ") end |
