aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rubygems/uninstaller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rubygems/uninstaller.rb')
-rw-r--r--lib/rubygems/uninstaller.rb16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/rubygems/uninstaller.rb b/lib/rubygems/uninstaller.rb
index 475211dfe3..d672b9dec1 100644
--- a/lib/rubygems/uninstaller.rb
+++ b/lib/rubygems/uninstaller.rb
@@ -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