зеркало из https://github.com/github/ruby.git
[rubygems/rubygems] Fix `gem uninstall <name>:<version>` failing on shadowed default gems
https://github.com/rubygems/rubygems/commit/29357a5dd6
This commit is contained in:
Родитель
3ebe249ce1
Коммит
419d3221fb
|
@ -157,9 +157,14 @@ that is a dependency of an existing gem. You can use the
|
||||||
|
|
||||||
gem_specs = Gem::Specification.find_all_by_name(name, original_gem_version[name])
|
gem_specs = Gem::Specification.find_all_by_name(name, original_gem_version[name])
|
||||||
|
|
||||||
say("Gem '#{name}' is not installed") if gem_specs.empty?
|
if gem_specs.empty?
|
||||||
gem_specs.each do |spec|
|
say("Gem '#{name}' is not installed")
|
||||||
deplist.add spec
|
else
|
||||||
|
gem_specs.reject!(&:default_gem?) if gem_specs.size > 1
|
||||||
|
|
||||||
|
gem_specs.each do |spec|
|
||||||
|
deplist.add spec
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -111,6 +111,31 @@ class TestGemCommandsUninstallCommand < Gem::InstallerTestCase
|
||||||
assert_equal "There was both a regular copy and a default copy of z-1. The regular copy was successfully uninstalled, but the default copy was left around because default gems can't be removed.", output.shift
|
assert_equal "There was both a regular copy and a default copy of z-1. The regular copy was successfully uninstalled, but the default copy was left around because default gems can't be removed.", output.shift
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_execute_does_not_error_on_shadowed_default_gems
|
||||||
|
z_1_default = new_default_spec "z", "1"
|
||||||
|
install_default_gems z_1_default
|
||||||
|
|
||||||
|
z_1 = util_spec "z", "1" do |spec|
|
||||||
|
spec.date = "2024-01-01"
|
||||||
|
end
|
||||||
|
install_gem z_1
|
||||||
|
|
||||||
|
Gem::Specification.reset
|
||||||
|
|
||||||
|
@cmd.options[:args] = %w[z:1]
|
||||||
|
|
||||||
|
use_ui @ui do
|
||||||
|
@cmd.execute
|
||||||
|
end
|
||||||
|
|
||||||
|
output = @ui.output.split "\n"
|
||||||
|
assert_equal "Successfully uninstalled z-1", output.shift
|
||||||
|
assert_equal "There was both a regular copy and a default copy of z-1. The regular copy was successfully uninstalled, but the default copy was left around because default gems can't be removed.", output.shift
|
||||||
|
|
||||||
|
error = @ui.error.split "\n"
|
||||||
|
assert_empty error
|
||||||
|
end
|
||||||
|
|
||||||
def test_execute_dependency_order
|
def test_execute_dependency_order
|
||||||
initial_install
|
initial_install
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче