summaryrefslogtreecommitdiff
path: root/lib/rubygems/commands/uninstall_command.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-08-26 20:24:51 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-08-26 20:24:51 +0000
commite487a7f53cffbadf0bf15ff169c9cb5898503250 (patch)
treeeaa80eb4ced6fcdcc8b327d1cc5e47f66703fd1b /lib/rubygems/commands/uninstall_command.rb
parentcddd93a57568966b416e300529bdffc0c7e87b51 (diff)
* lib/rubygems: Import RubyGems 2.1.0 Release Candidate
* test/rubygems: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42693 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/commands/uninstall_command.rb')
-rw-r--r--lib/rubygems/commands/uninstall_command.rb25
1 files changed, 19 insertions, 6 deletions
diff --git a/lib/rubygems/commands/uninstall_command.rb b/lib/rubygems/commands/uninstall_command.rb
index 5db8a1ff22..8e6af2ba65 100644
--- a/lib/rubygems/commands/uninstall_command.rb
+++ b/lib/rubygems/commands/uninstall_command.rb
@@ -88,6 +88,16 @@ class Gem::Commands::UninstallCommand < Gem::Command
"--user-install"
end
+ def description # :nodoc:
+ <<-EOF
+The uninstall command removes a previously installed gem.
+
+RubyGems will ask for confirmation if you are attempting to uninstall a gem
+that is a dependency of an existing gem. You can use the
+--ignore-dependencies option to skip this check.
+ EOF
+ end
+
def usage # :nodoc:
"#{program_name} GEMNAME [GEMNAME ...]"
end
@@ -104,15 +114,18 @@ class Gem::Commands::UninstallCommand < Gem::Command
end
def uninstall_all
- install_dir = options[:install_dir]
+ _, specs = Gem::Specification.partition { |spec| spec.default_gem? }
- dirs_to_be_emptied = Dir[File.join(install_dir, '*')]
- dirs_to_be_emptied.delete_if { |dir| dir.end_with? 'build_info' }
+ specs.each do |spec|
+ options[:version] = spec.version
- dirs_to_be_emptied.each do |dir|
- FileUtils.rm_rf Dir[File.join(dir, '*')]
+ begin
+ Gem::Uninstaller.new(spec.name, options).uninstall
+ rescue Gem::InstallError
+ end
end
- alert("Successfully uninstalled all gems in #{install_dir}")
+
+ alert "Uninstalled all gems in #{options[:install_dir]}"
end
def uninstall_specific