Gem uninstaller command line tool
See `gem help uninstall`
# 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
# File lib/rubygems/commands/uninstall_command.rb, line 75
75: def execute
76: original_path = Gem.path
77:
78: get_all_gem_names.each do |gem_name|
79: begin
80: Gem::Uninstaller.new(gem_name, options).uninstall
81: rescue Gem::InstallError => e
82: alert e.message
83: rescue Gem::GemNotInHomeException => e
84: spec = e.spec
85: alert("In order to remove #{spec.name}, please execute:\n" "\tgem uninstall #{spec.name} --install-dir=#{spec.installation_path}")
86: ensure
87: Gem.use_paths(*original_path)
88: end
89: end
90: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.