[rubygems/rubygems] Fix gem uninstall
with --install-dir
https://github.com/rubygems/rubygems/commit/ac23687353
This commit is contained in:
parent
123bedd295
commit
dd0f0a5e6e
@ -125,6 +125,9 @@ that is a dependency of an existing gem. You can use the
|
||||
def execute
|
||||
check_version
|
||||
|
||||
# Consider only gem specifications installed at `--install-dir`
|
||||
Gem::Specification.dirs = options[:install_dir] if options[:install_dir]
|
||||
|
||||
if options[:all] && !options[:args].empty?
|
||||
uninstall_specific
|
||||
elsif options[:all]
|
||||
|
@ -375,6 +375,26 @@ class TestGemCommandsUninstallCommand < Gem::InstallerTestCase
|
||||
assert_includes e.message, "a is not installed in GEM_HOME"
|
||||
end
|
||||
|
||||
def test_execute_outside_gem_home_when_install_dir_given
|
||||
gemhome2 = "#{@gemhome}2"
|
||||
|
||||
a_4, = util_gem "a", 4
|
||||
install_gem a_4 , :install_dir => gemhome2
|
||||
|
||||
assert_gems_presence "a-4", dirs: [@gemhome, gemhome2]
|
||||
|
||||
Gem::Specification.dirs = [@gemhome]
|
||||
|
||||
@cmd.options[:install_dir] = gemhome2
|
||||
@cmd.options[:args] = ["a:4"]
|
||||
|
||||
@cmd.execute
|
||||
|
||||
Gem::Specification.dirs = [gemhome2]
|
||||
|
||||
refute_includes Gem::Specification.all_names.sort, "a-4"
|
||||
end
|
||||
|
||||
def test_handle_options
|
||||
@cmd.handle_options %w[]
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user