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 64
 64:   def execute
 65:     out = ''
 66:     arg = options[:args][0]
 67:     case arg
 68:     when /^packageversion/ then
 69:       out << Gem::RubyGemsPackageVersion
 70:     when /^version/ then
 71:       out << Gem::VERSION
 72:     when /^gemdir/, /^gemhome/, /^home/, /^GEM_HOME/ then
 73:       out << Gem.dir
 74:     when /^gempath/, /^path/, /^GEM_PATH/ then
 75:       out << Gem.path.join(File::PATH_SEPARATOR)
 76:     when /^remotesources/ then
 77:       out << Gem.sources.join("\n")
 78:     when /^platform/ then
 79:       out << Gem.platforms.join(File::PATH_SEPARATOR)
 80:     when nil then
 81:       out = "RubyGems Environment:\n"
 82: 
 83:       out << "  - RUBYGEMS VERSION: #{Gem::VERSION}\n"
 84: 
 85:       out << "  - RUBY VERSION: #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}"
 86:       out << " patchlevel #{RUBY_PATCHLEVEL}" if defined? RUBY_PATCHLEVEL
 87:       out << ") [#{RUBY_PLATFORM}]\n"
 88: 
 89:       out << "  - INSTALLATION DIRECTORY: #{Gem.dir}\n"
 90: 
 91:       out << "  - RUBYGEMS PREFIX: #{Gem.prefix}\n" unless Gem.prefix.nil?
 92: 
 93:       out << "  - RUBY EXECUTABLE: #{Gem.ruby}\n"
 94: 
 95:       out << "  - EXECUTABLE DIRECTORY: #{Gem.bindir}\n"
 96: 
 97:       out << "  - RUBYGEMS PLATFORMS:\n"
 98:       Gem.platforms.each do |platform|
 99:         out << "    - #{platform}\n"
100:       end
101: 
102:       out << "  - GEM PATHS:\n"
103:       out << "     - #{Gem.dir}\n"
104: 
105:       path = Gem.path.dup
106:       path.delete Gem.dir
107:       path.each do |p|
108:         out << "     - #{p}\n"
109:       end
110: 
111:       out << "  - GEM CONFIGURATION:\n"
112:       Gem.configuration.each do |name, value|
113:         value = value.gsub(/./, '*') if name == 'gemcutter_key'
114:         out << "     - #{name.inspect} => #{value.inspect}\n"
115:       end
116: 
117:       out << "  - REMOTE SOURCES:\n"
118:       Gem.sources.each do |s|
119:         out << "     - #{s}\n"
120:       end
121: 
122:     else
123:       raise Gem::CommandLineError, "Unknown environment option [#{arg}]"
124:     end
125:     say out
126:     true
127:   end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.