Skip to content

Commit 32a9f29

Browse files
deivid-rodriguezhsbt
authored andcommitted
[rubygems/rubygems] Remove no longer necessary workarounds for restarts
Since we no longer pass ruby CLI flags in our spec commands, we no longer need the previous workaround and can get the realworld code tested. ruby/rubygems@fd92c855fb
1 parent 6217216 commit 32a9f29

File tree

5 files changed

+9
-26
lines changed

5 files changed

+9
-26
lines changed

lib/bundler/self_manager.rb

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -70,24 +70,9 @@ def restart_with(version)
7070
configured_gem_home = ENV["GEM_HOME"]
7171
configured_gem_path = ENV["GEM_PATH"]
7272

73-
# Bundler specs need some stuff to be required before Bundler starts
74-
# running, for example, for faking the compact index API. However, these
75-
# flags are lost when we reexec to a different version of Bundler. In the
76-
# future, we may be able to properly reconstruct the original Ruby
77-
# invocation (see https://bugs.ruby-lang.org/issues/6648), but for now
78-
# there's no way to do it, so we need to be explicit about how to re-exec.
79-
# This may be a feature end users request at some point, but maybe by that
80-
# time, we have builtin tools to do. So for now, we use an undocumented
81-
# ENV variable only for our specs.
82-
bundler_spec_original_cmd = ENV["BUNDLER_SPEC_ORIGINAL_CMD"]
83-
if bundler_spec_original_cmd
84-
require "shellwords"
85-
cmd = [*Shellwords.shellsplit(bundler_spec_original_cmd), *ARGV]
86-
else
87-
argv0 = File.exist?($PROGRAM_NAME) ? $PROGRAM_NAME : Process.argv0
88-
cmd = [argv0, *ARGV]
89-
cmd.unshift(Gem.ruby) unless File.executable?(argv0)
90-
end
73+
argv0 = File.exist?($PROGRAM_NAME) ? $PROGRAM_NAME : Process.argv0
74+
cmd = [argv0, *ARGV]
75+
cmd.unshift(Gem.ruby) unless File.executable?(argv0)
9176

9277
Bundler.with_original_env do
9378
Kernel.exec(

spec/bundler/commands/update_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1558,7 +1558,7 @@
15581558
G
15591559
lockfile lockfile.sub(/(^\s*)#{Bundler::VERSION}($)/, "2.99.9")
15601560

1561-
bundle :update, bundler: true, verbose: true, preserve_ruby_flags: true, env: { "BUNDLER_4_MODE" => nil }
1561+
bundle :update, bundler: true, verbose: true, env: { "BUNDLER_4_MODE" => nil }
15621562

15631563
expect(out).to include("Updating bundler to 999.0.0")
15641564
expect(out).to include("Running `bundle update --bundler \"> 0.a\" --verbose` with bundler 999.0.0")

spec/bundler/lock/lockfile_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@
109109
#{version}
110110
L
111111

112-
install_gemfile <<-G, verbose: true, preserve_ruby_flags: true, env: { "BUNDLER_4_MODE" => nil }
112+
install_gemfile <<-G, verbose: true, env: { "BUNDLER_4_MODE" => nil }
113113
source "https://gem.repo4"
114114
115115
gem "myrack"

spec/bundler/runtime/self_management_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
lockfile_bundled_with(previous_minor)
3535

3636
bundle "config set --local path.system true"
37-
bundle "install", preserve_ruby_flags: true
37+
bundle "install"
3838
expect(out).to include("Bundler #{current_version} is running, but your lockfile was generated with #{previous_minor}. Installing Bundler #{previous_minor} and restarting using that version.")
3939

4040
# It uninstalls the older system bundler
@@ -70,7 +70,7 @@
7070
lockfile_bundled_with(previous_minor)
7171

7272
bundle "config set --local path vendor/bundle"
73-
bundle "install", preserve_ruby_flags: true
73+
bundle "install"
7474
expect(out).to include("Bundler #{current_version} is running, but your lockfile was generated with #{previous_minor}. Installing Bundler #{previous_minor} and restarting using that version.")
7575
expect(vendored_gems("gems/bundler-#{previous_minor}")).to exist
7676

@@ -107,7 +107,7 @@
107107
lockfile_bundled_with(previous_minor)
108108

109109
bundle "config set --local deployment true"
110-
bundle "install", preserve_ruby_flags: true
110+
bundle "install"
111111
expect(out).to include("Bundler #{current_version} is running, but your lockfile was generated with #{previous_minor}. Installing Bundler #{previous_minor} and restarting using that version.")
112112
expect(vendored_gems("gems/bundler-#{previous_minor}")).to exist
113113

@@ -162,7 +162,7 @@
162162
lockfile_bundled_with(current_version)
163163

164164
bundle "config set --local version #{previous_minor}"
165-
bundle "install", preserve_ruby_flags: true
165+
bundle "install"
166166
expect(out).to include("Bundler #{current_version} is running, but your configuration was #{previous_minor}. Installing Bundler #{previous_minor} and restarting using that version.")
167167

168168
bundle "-v"

spec/bundler/support/helpers.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ def bundle(cmd, options = {}, &block)
7171
bundle_bin ||= installed_bindir.join("bundle")
7272

7373
env = options.delete(:env) || {}
74-
preserve_ruby_flags = options.delete(:preserve_ruby_flags)
7574

7675
requires = options.delete(:requires) || []
7776

@@ -102,7 +101,6 @@ def bundle(cmd, options = {}, &block)
102101
end.join
103102

104103
cmd = "#{Gem.ruby} #{bundle_bin} #{cmd}#{args}"
105-
env["BUNDLER_SPEC_ORIGINAL_CMD"] = "#{Gem.ruby} #{bundle_bin}" if preserve_ruby_flags
106104
sys_exec(cmd, { env: env, dir: dir, raise_on_error: raise_on_error }, &block)
107105
end
108106

0 commit comments

Comments
 (0)