summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2021-11-04 19:27:17 +0100
committergit <svn-admin@ruby-lang.org>2021-11-05 23:20:50 +0900
commit907aa4752752869193f333c4114da85080ec03e3 (patch)
tree974adbe2c7d25f9ec277530c95ab8834d3be29ee /lib
parentd47831d554a9fa3ba4a78371914cb2ceb1fec1f7 (diff)
[rubygems/rubygems] Fix `ruby setup.rb` command when `--prefix` is passed
https://github.com/rubygems/rubygems/commit/8d04092f6e
Diffstat (limited to 'lib')
-rw-r--r--lib/rubygems/commands/setup_command.rb16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/rubygems/commands/setup_command.rb b/lib/rubygems/commands/setup_command.rb
index 2041d67c0d..ed0a96d19d 100644
--- a/lib/rubygems/commands/setup_command.rb
+++ b/lib/rubygems/commands/setup_command.rb
@@ -360,7 +360,7 @@ By default, this RubyGems will install gem as:
end
def install_default_bundler_gem(bin_dir)
- specs_dir = prepend_destdir_if_present(Gem.default_specifications_dir)
+ specs_dir = File.join(default_dir, "specifications", "default")
mkdir_p specs_dir, :mode => 0755
bundler_spec = Dir.chdir("bundler") { Gem::Specification.load("bundler.gemspec") }
@@ -388,7 +388,7 @@ By default, this RubyGems will install gem as:
bundler_spec.instance_variable_set(:@base_dir, File.dirname(File.dirname(specs_dir)))
# Remove gemspec that was same version of vendored bundler.
- normal_gemspec = File.join(Gem.default_dir, "specifications", "bundler-#{bundler_spec.version}.gemspec")
+ normal_gemspec = File.join(default_dir, "specifications", "bundler-#{bundler_spec.version}.gemspec")
if File.file? normal_gemspec
File.delete normal_gemspec
end
@@ -607,6 +607,18 @@ abort "#{deprecation_message}"
private
+ def default_dir
+ prefix = options[:prefix]
+
+ if prefix.empty?
+ dir = Gem.default_dir
+ else
+ dir = prefix
+ end
+
+ prepend_destdir_if_present(dir)
+ end
+
def prepend_destdir_if_present(path)
destdir = options[:destdir]
return path if destdir.empty?