TASAKA Mamoru bc96e30
--- ruby-1.9.3-p0/lib/rubygems/uninstaller.rb.orig	2011-10-31 10:22:36.321579483 +0100
TASAKA Mamoru bc96e30
+++ ruby-1.9.3-p0/lib/rubygems/uninstaller.rb	2011-10-31 10:34:25.563626119 +0100
TASAKA Mamoru bc96e30
@@ -51,15 +51,14 @@
TASAKA Mamoru bc96e30
     @bin_dir           = options[:bin_dir]
TASAKA Mamoru bc96e30
     @format_executable = options[:format_executable]
TASAKA Mamoru bc96e30
 
TASAKA Mamoru bc96e30
+    if options[:force]
TASAKA Mamoru bc96e30
+      @force_all = true
TASAKA Mamoru bc96e30
+      @force_ignore = true
TASAKA Mamoru bc96e30
+    end
TASAKA Mamoru bc96e30
+
TASAKA Mamoru bc96e30
     # only add user directory if install_dir is not set
TASAKA Mamoru bc96e30
     @user_install = false
TASAKA Mamoru bc96e30
     @user_install = options[:user_install] unless options[:install_dir]
TASAKA Mamoru bc96e30
-
TASAKA Mamoru bc96e30
-    if @user_install then
TASAKA Mamoru bc96e30
-      Gem.use_paths Gem.user_dir, @gem_home
TASAKA Mamoru bc96e30
-    else
TASAKA Mamoru bc96e30
-      Gem.use_paths @gem_home
TASAKA Mamoru bc96e30
-    end
TASAKA Mamoru bc96e30
   end
TASAKA Mamoru bc96e30
 
TASAKA Mamoru bc96e30
   ##
TASAKA Mamoru bc96e30
@@ -69,10 +68,24 @@
TASAKA Mamoru bc96e30
   def uninstall
TASAKA Mamoru bc96e30
     list = Gem::Specification.find_all_by_name(@gem, @version)
TASAKA Mamoru bc96e30
 
TASAKA Mamoru bc96e30
+    list, other_repo_specs = list.partition do |spec|
TASAKA Mamoru bc96e30
+      @gem_home == spec.base_dir or
TASAKA Mamoru bc96e30
+      (@user_install and spec.base_dir == Gem.user_dir)
TASAKA Mamoru bc96e30
+    end
TASAKA Mamoru bc96e30
+
TASAKA Mamoru bc96e30
     if list.empty? then
TASAKA Mamoru bc96e30
-      raise Gem::InstallError, "gem #{@gem.inspect} is not installed"
TASAKA Mamoru bc96e30
+      raise Gem::InstallError, "gem #{@gem.inspect} is not installed" if
TASAKA Mamoru bc96e30
+        other_repo_specs.empty?
TASAKA Mamoru bc96e30
+
TASAKA Mamoru bc96e30
+      other_repos = other_repo_specs.map { |spec| spec.base_dir }.uniq
TASAKA Mamoru bc96e30
+
TASAKA Mamoru bc96e30
+      message = ["#{@gem} is not installed in GEM_HOME, try:"]
TASAKA Mamoru bc96e30
+      message.concat other_repos.map { |repo|
TASAKA Mamoru bc96e30
+        "\tgem uninstall -i #{repo} #{@gem}"
TASAKA Mamoru bc96e30
+      }
TASAKA Mamoru bc96e30
 
TASAKA Mamoru bc96e30
-    elsif list.size > 1 and @force_all then
TASAKA Mamoru bc96e30
+      raise Gem::InstallError, message.join("\n")
TASAKA Mamoru bc96e30
+    elsif @force_all then
TASAKA Mamoru bc96e30
       remove_all list
TASAKA Mamoru bc96e30
 
TASAKA Mamoru bc96e30
     elsif list.size > 1 then
TASAKA Mamoru bc96e30
@@ -250,12 +263,10 @@
TASAKA Mamoru bc96e30
     msg << "\t#{spec.full_name}"
TASAKA Mamoru bc96e30
 
TASAKA Mamoru bc96e30
     spec.dependent_gems.each do |dep_spec, dep, satlist|
TASAKA Mamoru bc96e30
-      msg <<
TASAKA Mamoru bc96e30
-        ("#{dep_spec.name}-#{dep_spec.version} depends on " +
TASAKA Mamoru bc96e30
-         "[#{dep.name} (#{dep.requirement})]")
TASAKA Mamoru bc96e30
+      msg << "#{dep_spec.name}-#{dep_spec.version} depends on #{dep}"
TASAKA Mamoru bc96e30
     end
TASAKA Mamoru bc96e30
 
TASAKA Mamoru bc96e30
-    msg << 'If you remove this gems, one or more dependencies will not be met.'
TASAKA Mamoru bc96e30
+    msg << 'If you remove this gem, one or more dependencies will not be met.'
TASAKA Mamoru bc96e30
     msg << 'Continue with Uninstall?'
TASAKA Mamoru bc96e30
     return ask_yes_no(msg.join("\n"), true)
TASAKA Mamoru bc96e30
   end
TASAKA Mamoru bc96e30
TASAKA Mamoru bc96e30
--- ruby-1.9.3-p0/test/rubygems/test_gem_uninstaller.rb.orig	2011-11-03 08:58:31.411272176 +0100
TASAKA Mamoru bc96e30
+++ ruby-1.9.3-p0/test/rubygems/test_gem_uninstaller.rb	2011-11-03 08:58:43.010272351 +0100
TASAKA Mamoru bc96e30
@@ -225,7 +225,7 @@
TASAKA Mamoru bc96e30
 
TASAKA Mamoru bc96e30
     uninstaller = Gem::Uninstaller.new('a')
TASAKA Mamoru bc96e30
 
TASAKA Mamoru bc96e30
-    use_ui Gem::MockGemUi.new("2\n") do
TASAKA Mamoru bc96e30
+    use_ui Gem::MockGemUi.new("2\ny\n") do
TASAKA Mamoru bc96e30
       uninstaller.uninstall
TASAKA Mamoru bc96e30
     end