1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/rubygems/commands/query_command.rb: Refactored to improve

maintainability.
* test/rubygems/test_gem_commands_query_command.rb:  Note default gems
  in gem list details.

* lib/rubygems/uninstaller.rb:  Detect all gems for uninstallation.
  This allows duplicate installs of default gems to be removed.
* lib/rubygems/specification.rb:  Allow use of ::each_spec.
* lib/rubygems/test_case.rb:  Added install_default_gems.
* test/rubygems/test_gem_commands_uninstall_command.rb:  Moved test
  down to the uninstaller tests.
* test/rubygems/test_gem_uninstaller.rb:  Test for uninstallation of
  default gems and duplicate default gems.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38461 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
drbrain 2012-12-19 07:19:10 +00:00
parent 1b2be1f8ca
commit eddc0685f2
8 changed files with 242 additions and 125 deletions

View file

@ -72,7 +72,19 @@ class Gem::Uninstaller
# directory, and the cached .gem file.
def uninstall
list = Gem::Specification.find_all_by_name(@gem, @version)
dependency = Gem::Dependency.new @gem, @version
list = []
dirs =
Gem::Specification.dirs +
[Gem::Specification.default_specifications_dir]
Gem::Specification.each_spec dirs do |spec|
next unless dependency.matches_spec? spec
list << spec
end
default_specs, list = list.partition do |spec|
spec.default_gem?
@ -80,7 +92,7 @@ class Gem::Uninstaller
list, other_repo_specs = list.partition do |spec|
@gem_home == spec.base_dir or
(@user_install and spec.base_dir == Gem.user_dir)
(@user_install and spec.base_dir == Gem.user_dir)
end
if list.empty? then