summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Rodríguez <[email protected]>2023-12-11 17:22:54 +0100
committerHiroshi SHIBATA <[email protected]>2023-12-12 10:04:56 +0900
commit23289ad45bcf67e218352503958e2d788fbb6c2c (patch)
tree7f68fa86b054df5ad8d544cad533dfb6ab0600b5 /lib
parenta811ebf3d5113971b6dc62a8c56053bca1a1d49b (diff)
[rubygems/rubygems] Extract some common strings to variables
https://github.com/rubygems/rubygems/commit/48bc573310
Diffstat (limited to 'lib')
-rw-r--r--lib/rubygems/commands/setup_command.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/rubygems/commands/setup_command.rb b/lib/rubygems/commands/setup_command.rb
index 9cef1c6c11..78eae2200d 100644
--- a/lib/rubygems/commands/setup_command.rb
+++ b/lib/rubygems/commands/setup_command.rb
@@ -374,13 +374,16 @@ By default, this RubyGems will install gem as:
end
bundler_spec = Dir.chdir("bundler") { Gem::Specification.load("bundler.gemspec") }
- default_spec_path = File.join(specs_dir, "#{bundler_spec.full_name}.gemspec")
+ full_name = bundler_spec.full_name
+ gemspec_path = "#{full_name}.gemspec"
+
+ default_spec_path = File.join(specs_dir, gemspec_path)
Gem.write_binary(default_spec_path, bundler_spec.to_ruby)
bundler_spec = Gem::Specification.load(default_spec_path)
# Remove gemspec that was same version of vendored bundler.
- normal_gemspec = File.join(default_dir, "specifications", "bundler-#{bundler_spec.version}.gemspec")
+ normal_gemspec = File.join(default_dir, "specifications", gemspec_path)
if File.file? normal_gemspec
File.delete normal_gemspec
end
@@ -388,7 +391,7 @@ By default, this RubyGems will install gem as:
# Remove gem files that were same version of vendored bundler.
if File.directory? bundler_spec.gems_dir
Dir.entries(bundler_spec.gems_dir).
- select {|default_gem| File.basename(default_gem) == "bundler-#{bundler_spec.version}" }.
+ select {|default_gem| File.basename(default_gem) == full_name }.
each {|default_gem| rm_r File.join(bundler_spec.gems_dir, default_gem) }
end