Parent

Methods

Class Index [+]

Quicksearch

Gem::Commands::EnvironmentCommand

Public Class Methods

new() click to toggle source
   # File lib/rubygems/commands/environment_command.rb, line 5
5:   def initialize
6:     super 'environment', 'Display information about the RubyGems environment'
7:   end

Public Instance Methods

execute() click to toggle source
     # File lib/rubygems/commands/environment_command.rb, line 65
 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

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.