diff options
author | David RodrÃguez <[email protected]> | 2022-07-16 13:17:58 +0200 |
---|---|---|
committer | git <[email protected]> | 2022-07-20 19:55:34 +0900 |
commit | fa5724cca97a22006c64bb382c3894e608c63c9e (patch) | |
tree | 06d4181e003f4d2fd75d13a13290e9fd8f5f3218 /lib/rubygems | |
parent | fae0d60120e8ab58b0130cbb30acf28aab733552 (diff) |
[rubygems/rubygems] Fix `ruby setup.rb --destdir /foo` modifying global specs
Running a command like that is actually removing any previous default
bundler specs in the default RubyGems installation (outside of destdir).
It should instead only modify destdir.
https://github.com/rubygems/rubygems/commit/5ed275383c
Diffstat (limited to 'lib/rubygems')
-rw-r--r-- | lib/rubygems/commands/setup_command.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/rubygems/commands/setup_command.rb b/lib/rubygems/commands/setup_command.rb index f85d435f58..db2fefa65e 100644 --- a/lib/rubygems/commands/setup_command.rb +++ b/lib/rubygems/commands/setup_command.rb @@ -361,17 +361,17 @@ By default, this RubyGems will install gem as: def install_default_bundler_gem(bin_dir) current_default_spec = Gem::Specification.default_stubs.find {|s| s.name == "bundler" } - specs_dir = if current_default_spec + specs_dir = if current_default_spec && default_dir == Gem.default_dir Gem::Specification.remove_spec current_default_spec loaded_from = current_default_spec.loaded_from File.delete(loaded_from) File.dirname(loaded_from) else - File.join(default_dir, "specifications", "default") + target_specs_dir = File.join(default_dir, "specifications", "default") + mkdir_p target_specs_dir, :mode => 0755 + target_specs_dir end - mkdir_p specs_dir, :mode => 0755 - bundler_spec = Dir.chdir("bundler") { Gem::Specification.load("bundler.gemspec") } default_spec_path = File.join(specs_dir, "#{bundler_spec.full_name}.gemspec") Gem.write_binary(default_spec_path, bundler_spec.to_ruby) |