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