Geminstaller C0 Coverage Information - RCov

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

Name Total Lines Lines of Code Total Coverage Code Coverage
spec/fixture/rubygems_dist/rubygems-trunk/lib/rubygems/commands/environment_command.rb 129 102
89.92%
88.24%

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 
3 class Gem::Commands::EnvironmentCommand < Gem::Command
4 
5   def initialize
6     super 'environment', 'Display information about the RubyGems environment'
7   end
8 
9   def arguments # :nodoc:
10     args = <<-EOF
11           packageversion  display the package version
12           gemdir          display the path where gems are installed
13           gempath         display path used to search for gems
14           version         display the gem format version
15           remotesources   display the remote gem servers
16           <omitted>       display everything
17     EOF
18     return args.gsub(/^\s+/, '')
19   end
20 
21   def description # :nodoc:
22     <<-EOF
23 The RubyGems environment can be controlled through command line arguments,
24 gemrc files, environment variables and built-in defaults.
25 
26 Command line argument defaults and some RubyGems defaults can be set in
27 ~/.gemrc file for individual users and a /etc/gemrc for all users.  A gemrc
28 is a YAML file with the following YAML keys:
29 
30   :sources: A YAML array of remote gem repositories to install gems from
31   :verbose: Verbosity of the gem command.  false, true, and :really are the
32             levels
33   :update_sources: Enable/disable automatic updating of repository metadata
34   :backtrace: Print backtrace when RubyGems encounters an error
35   :bulk_threshold: Switch to a bulk update when this many sources are out of
36                    date (legacy setting)
37   :gempath: The paths in which to look for gems
38   gem_command: A string containing arguments for the specified gem command
39 
40 Example:
41 
42   :verbose: false
43   install: --no-wrappers
44   update: --no-wrappers
45 
46 RubyGems' default local repository can be overriden with the GEM_PATH and
47 GEM_HOME environment variables.  GEM_HOME sets the default repository to
48 install into.  GEM_PATH allows multiple local repositories to be searched for
49 gems.
50 
51 If you are behind a proxy server, RubyGems uses the HTTP_PROXY,
52 HTTP_PROXY_USER and HTTP_PROXY_PASS environment variables to discover the
53 proxy server.
54 
55 If you are packaging RubyGems all of RubyGems' defaults are in
56 lib/rubygems/defaults.rb.  You may override these in
57 lib/rubygems/defaults/operating_system.rb
58     EOF
59   end
60 
61   def usage # :nodoc:
62     "#{program_name} [arg]"
63   end
64 
65   def execute
66     out = ''
67     arg = options[:args][0]
68     case arg
69     when /^packageversion/ then
70       out << Gem::RubyGemsPackageVersion
71     when /^version/ then
72       out << Gem::VERSION
73     when /^gemdir/, /^gemhome/, /^home/, /^GEM_HOME/ then
74       out << Gem.dir
75     when /^gempath/, /^path/, /^GEM_PATH/ then
76       out << Gem.path.join(File::PATH_SEPARATOR)
77     when /^remotesources/ then
78       out << Gem.sources.join("\n")
79     when nil then
80       out = "RubyGems Environment:\n"
81 
82       out << "  - RUBYGEMS VERSION: #{Gem::VERSION}\n"
83 
84       out << "  - RUBY VERSION: #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}"
85       out << " patchlevel #{RUBY_PATCHLEVEL}" if defined? RUBY_PATCHLEVEL
86       out << ") [#{RUBY_PLATFORM}]\n"
87 
88       out << "  - INSTALLATION DIRECTORY: #{Gem.dir}\n"
89 
90       out << "  - RUBYGEMS PREFIX: #{Gem.prefix}\n" unless Gem.prefix.nil?
91 
92       out << "  - RUBY EXECUTABLE: #{Gem.ruby}\n"
93 
94       out << "  - EXECUTABLE DIRECTORY: #{Gem.bindir}\n"
95 
96       out << "  - RUBYGEMS PLATFORMS:\n"
97       Gem.platforms.each do |platform|
98         out << "    - #{platform}\n"
99       end
100 
101       out << "  - GEM PATHS:\n"
102       out << "     - #{Gem.dir}\n"
103 
104       path = Gem.path.dup
105       path.delete Gem.dir
106       path.each do |p|
107         out << "     - #{p}\n"
108       end
109 
110       out << "  - GEM CONFIGURATION:\n"
111       Gem.configuration.each do |name, value|
112         value = value.gsub(/./, '*') if name == 'gemcutter_key'
113         out << "     - #{name.inspect} => #{value.inspect}\n"
114       end
115 
116       out << "  - REMOTE SOURCES:\n"
117       Gem.sources.each do |s|
118         out << "     - #{s}\n"
119       end
120 
121     else
122       raise Gem::CommandLineError, "Unknown enviroment option [#{arg}]"
123     end
124     say out
125     true
126   end
127 
128 end
129 

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