Class Gem::Commands::EnvironmentCommand
In: lib/rubygems/commands/environment_command.rb
Parent: Gem::Command

Methods

execute   new  

Public Class methods

[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

[Source]

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

[Validate]