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_option('--[no-]format-executable',
53:                'Assume executable names match Ruby\'s prefix and suffix.') do |value, options|
54:       options[:format_executable] = value
55:     end
56: 
57:     add_version_option
58:     add_platform_option
59:   end

Public Instance methods

[Source]

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

[Validate]