[rubygems/rubygems] Fix ruby setup.rb
command when --prefix
is passed
https://github.com/rubygems/rubygems/commit/8d04092f6e
This commit is contained in:
parent
d47831d554
commit
907aa47527
@ -360,7 +360,7 @@ By default, this RubyGems will install gem as:
|
|||||||
end
|
end
|
||||||
|
|
||||||
def install_default_bundler_gem(bin_dir)
|
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
|
mkdir_p specs_dir, :mode => 0755
|
||||||
|
|
||||||
bundler_spec = Dir.chdir("bundler") { Gem::Specification.load("bundler.gemspec") }
|
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)))
|
bundler_spec.instance_variable_set(:@base_dir, File.dirname(File.dirname(specs_dir)))
|
||||||
|
|
||||||
# Remove gemspec that was same version of vendored bundler.
|
# 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
|
if File.file? normal_gemspec
|
||||||
File.delete normal_gemspec
|
File.delete normal_gemspec
|
||||||
end
|
end
|
||||||
@ -607,6 +607,18 @@ abort "#{deprecation_message}"
|
|||||||
|
|
||||||
private
|
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)
|
def prepend_destdir_if_present(path)
|
||||||
destdir = options[:destdir]
|
destdir = options[:destdir]
|
||||||
return path if destdir.empty?
|
return path if destdir.empty?
|
||||||
|
@ -259,6 +259,24 @@ class TestGemCommandsSetupCommand < Gem::TestCase
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_install_default_bundler_gem_with_destdir_and_prefix_flags
|
||||||
|
@cmd.extend FileUtils
|
||||||
|
|
||||||
|
destdir = File.join(@tempdir, 'foo')
|
||||||
|
bin_dir = File.join(destdir, 'bin')
|
||||||
|
|
||||||
|
@cmd.options[:destdir] = destdir
|
||||||
|
@cmd.options[:prefix] = "/"
|
||||||
|
|
||||||
|
@cmd.install_default_bundler_gem bin_dir
|
||||||
|
|
||||||
|
spec = Gem::Specification.load("bundler/bundler.gemspec")
|
||||||
|
|
||||||
|
spec.executables.each do |e|
|
||||||
|
assert_path_exist File.join destdir, 'gems', spec.full_name, spec.bindir, e
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def test_remove_old_lib_files
|
def test_remove_old_lib_files
|
||||||
lib = RbConfig::CONFIG["sitelibdir"]
|
lib = RbConfig::CONFIG["sitelibdir"]
|
||||||
lib_rubygems = File.join lib, 'rubygems'
|
lib_rubygems = File.join lib, 'rubygems'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user