Geminstaller C0 Coverage Information - RCov

spec/fixture/rubygems_dist/rubygems-trunk/lib/rubygems/commands/uninstall_command.rb

Name Total Lines Lines of Code Total Coverage Code Coverage
spec/fixture/rubygems_dist/rubygems-trunk/lib/rubygems/commands/uninstall_command.rb 83 62
75.90%
69.35%

Key

Code reported as executed by Ruby looks like this...and this: this line is also marked as covered.Lines considered as run by rcov, but not reported by Ruby, look like this,and this: these lines were inferred by rcov (using simple heuristics).Finally, here's a line marked as not executed.

Coverage Details

1 require 'rubygems/command'
2 require 'rubygems/version_option'
3 require 'rubygems/uninstaller'
4 
5 ##
6 # Gem uninstaller command line tool
7 #
8 # See `gem help uninstall`
9 
10 class Gem::Commands::UninstallCommand < Gem::Command
11 
12   include Gem::VersionOption
13 
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
55 
56   def arguments # :nodoc:
57     "GEMNAME       name of gem to uninstall"
58   end
59 
60   def defaults_str # :nodoc:
61     "--version '#{Gem::Requirement.default}' --no-force " \
62     "--install-dir #{Gem.dir}\n" \
63     "--user-install"
64   end
65 
66   def usage # :nodoc:
67     "#{program_name} GEMNAME [GEMNAME ...]"
68   end
69 
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
81 
82 end
83 

Generated on Mon May 10 23:40:28 -0700 2010 with rcov 0.9.8