mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[rubygems/rubygems] Fix rubygems update when non default --install-dir
is configured
9f3b21192d
This commit is contained in:
parent
6b0131db6f
commit
e78c1ddb1e
2 changed files with 35 additions and 5 deletions
|
@ -173,10 +173,11 @@ command to remove old versions.
|
||||||
highest_remote_gem.first
|
highest_remote_gem.first
|
||||||
end
|
end
|
||||||
|
|
||||||
def install_rubygems(version) # :nodoc:
|
def install_rubygems(spec) # :nodoc:
|
||||||
args = update_rubygems_arguments
|
args = update_rubygems_arguments
|
||||||
|
version = spec.version
|
||||||
|
|
||||||
update_dir = File.join Gem.dir, 'gems', "rubygems-update-#{version}"
|
update_dir = File.join spec.base_dir, 'gems', "rubygems-update-#{version}"
|
||||||
|
|
||||||
Dir.chdir update_dir do
|
Dir.chdir update_dir do
|
||||||
say "Installing RubyGems #{version}" unless options[:silent]
|
say "Installing RubyGems #{version}" unless options[:silent]
|
||||||
|
@ -290,9 +291,7 @@ command to remove old versions.
|
||||||
installed_gems = update_gem('rubygems-update', version) if installed_gems.empty? || installed_gems.first.version != version
|
installed_gems = update_gem('rubygems-update', version) if installed_gems.empty? || installed_gems.first.version != version
|
||||||
return if installed_gems.empty?
|
return if installed_gems.empty?
|
||||||
|
|
||||||
version = installed_gems.first.version
|
install_rubygems installed_gems.first
|
||||||
|
|
||||||
install_rubygems version
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def update_rubygems_arguments # :nodoc:
|
def update_rubygems_arguments # :nodoc:
|
||||||
|
|
|
@ -191,6 +191,37 @@ class TestGemCommandsUpdateCommand < Gem::TestCase
|
||||||
assert_empty out
|
assert_empty out
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_execute_system_update_installed_in_non_default_gem_path
|
||||||
|
rubygems_update_spec = quick_gem "rubygems-update", 9 do |s|
|
||||||
|
write_file File.join(@tempdir, 'setup.rb')
|
||||||
|
|
||||||
|
s.files += %w[setup.rb]
|
||||||
|
end
|
||||||
|
|
||||||
|
util_setup_spec_fetcher rubygems_update_spec
|
||||||
|
|
||||||
|
rubygems_update_package = Gem::Package.build rubygems_update_spec
|
||||||
|
|
||||||
|
gemhome2 = "#{@gemhome}2"
|
||||||
|
|
||||||
|
Gem::Installer.at(rubygems_update_package, :install_dir => gemhome2).install
|
||||||
|
|
||||||
|
Gem.use_paths @gemhome, [gemhome2, @gemhome]
|
||||||
|
|
||||||
|
@cmd.options[:args] = []
|
||||||
|
@cmd.options[:system] = true
|
||||||
|
|
||||||
|
use_ui @ui do
|
||||||
|
@cmd.execute
|
||||||
|
end
|
||||||
|
|
||||||
|
out = @ui.output.split "\n"
|
||||||
|
assert_equal "Installing RubyGems 9", out.shift
|
||||||
|
assert_equal "RubyGems system software updated", out.shift
|
||||||
|
|
||||||
|
assert_empty out
|
||||||
|
end
|
||||||
|
|
||||||
def test_execute_system_specific
|
def test_execute_system_specific
|
||||||
spec_fetcher do |fetcher|
|
spec_fetcher do |fetcher|
|
||||||
fetcher.download 'rubygems-update', 8 do |s|
|
fetcher.download 'rubygems-update', 8 do |s|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue