| Class | Gem::Commands::UninstallCommand |
| In: |
lib/rubygems/commands/uninstall_command.rb
|
| Parent: | Command |
# File lib/rubygems/commands/uninstall_command.rb, line 11
11: def initialize
12: super 'uninstall', 'Uninstall gems from the local repository',
13: :version => Gem::Requirement.default
14:
15: add_option('-a', '--[no-]all',
16: 'Uninstall all matching versions'
17: ) do |value, options|
18: options[:all] = value
19: end
20:
21: add_option('-I', '--[no-]ignore-dependencies',
22: 'Ignore dependency requirements while',
23: 'uninstalling') do |value, options|
24: options[:ignore] = value
25: end
26:
27: add_option('-x', '--[no-]executables',
28: 'Uninstall applicable executables without',
29: 'confirmation') do |value, options|
30: options[:executables] = value
31: end
32:
33: add_option('-i', '--install-dir DIR',
34: 'Directory to uninstall gem from') do |value, options|
35: options[:install_dir] = File.expand_path(value)
36: end
37:
38: add_option('-n', '--bindir DIR',
39: 'Directory to remove binaries from') do |value, options|
40: options[:bin_dir] = File.expand_path(value)
41: end
42:
43: add_version_option
44: add_platform_option
45: end
# File lib/rubygems/commands/uninstall_command.rb, line 60
60: def execute
61: get_all_gem_names.each do |gem_name|
62: begin
63: Gem::Uninstaller.new(gem_name, options).uninstall
64: rescue Gem::GemNotInHomeException => e
65: spec = e.spec
66: alert("In order to remove #{spec.name}, please execute:\n" \
67: "\tgem uninstall #{spec.name} --install-dir=#{spec.installation_path}")
68: end
69: end
70: end