Class Gem::Commands::UninstallCommand
In: lib/rubygems/commands/uninstall_command.rb
Parent: Gem::Command

Gem uninstaller command line tool

See `gem help uninstall`

Methods

execute   new  

Included Modules

Gem::VersionOption

Public Class methods

[Source]

    # File lib/rubygems/commands/uninstall_command.rb, line 14
14:   def initialize
15:     super 'uninstall', 'Uninstall gems from the local repository',
16:           :version => Gem::Requirement.default, :user_install => true
17: 
18:     add_option('-a', '--[no-]all',
19:       'Uninstall all matching versions'
20:       ) do |value, options|
21:       options[:all] = value
22:     end
23: 
24:     add_option('-I', '--[no-]ignore-dependencies',
25:                'Ignore dependency requirements while',
26:                'uninstalling') do |value, options|
27:       options[:ignore] = value
28:     end
29: 
30:     add_option('-x', '--[no-]executables',
31:                  'Uninstall applicable executables without',
32:                  'confirmation') do |value, options|
33:       options[:executables] = value
34:     end
35: 
36:     add_option('-i', '--install-dir DIR',
37:                'Directory to uninstall gem from') do |value, options|
38:       options[:install_dir] = File.expand_path(value)
39:     end
40: 
41:     add_option('-n', '--bindir DIR',
42:                'Directory to remove binaries from') do |value, options|
43:       options[:bin_dir] = File.expand_path(value)
44:     end
45: 
46:     add_option('--[no-]user-install',
47:                'Uninstall from user\'s home directory',
48:                'in addition to GEM_HOME.') do |value, options|
49:       options[:user_install] = value
50:     end
51: 
52:     add_version_option
53:     add_platform_option
54:   end

Public Instance methods

[Source]

    # File lib/rubygems/commands/uninstall_command.rb, line 70
70:   def execute
71:     get_all_gem_names.each do |gem_name|
72:       begin
73:         Gem::Uninstaller.new(gem_name, options).uninstall
74:       rescue Gem::GemNotInHomeException => e
75:         spec = e.spec
76:         alert("In order to remove #{spec.name}, please execute:\n" \
77:               "\tgem uninstall #{spec.name} --install-dir=#{spec.installation_path}")
78:       end
79:     end
80:   end

[Validate]