aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rubygems/commands/environment_command.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-03-31 22:40:06 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-03-31 22:40:06 +0000
commit8cc45aae947d453acca029e13eb64f3f5f0bf942 (patch)
treef9485a20c99defe1aae3f32555a41d23c2298ad8 /lib/rubygems/commands/environment_command.rb
parentdc8359969ec71ece10357ba9396430db7f029e45 (diff)
downloadruby-8cc45aae947d453acca029e13eb64f3f5f0bf942.tar.gz
Import RubyGems 1.1.0
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/commands/environment_command.rb')
-rw-r--r--lib/rubygems/commands/environment_command.rb20
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/rubygems/commands/environment_command.rb b/lib/rubygems/commands/environment_command.rb
index ab85361753..56b373cfbe 100644
--- a/lib/rubygems/commands/environment_command.rb
+++ b/lib/rubygems/commands/environment_command.rb
@@ -25,19 +25,18 @@ class Gem::Commands::EnvironmentCommand < Gem::Command
def execute
out = ''
arg = options[:args][0]
- if begins?("packageversion", arg) then
+ case arg
+ when /^packageversion/ then
out << Gem::RubyGemsPackageVersion
- elsif begins?("version", arg) then
+ when /^version/ then
out << Gem::RubyGemsVersion
- elsif begins?("gemdir", arg) then
+ when /^gemdir/, /^gemhome/, /^home/, /^GEM_HOME/ then
out << Gem.dir
- elsif begins?("gempath", arg) then
- out << Gem.path.join("\n")
- elsif begins?("remotesources", arg) then
+ when /^gempath/, /^path/, /^GEM_PATH/ then
+ out << Gem.path.join(File::PATH_SEPARATOR)
+ when /^remotesources/ then
out << Gem.sources.join("\n")
- elsif arg then
- fail Gem::CommandLineError, "Unknown enviroment option [#{arg}]"
- else
+ when nil then
out = "RubyGems Environment:\n"
out << " - RUBYGEMS VERSION: #{Gem::RubyGemsVersion} (#{Gem::RubyGemsPackageVersion})\n"
@@ -75,6 +74,9 @@ class Gem::Commands::EnvironmentCommand < Gem::Command
Gem.sources.each do |s|
out << " - #{s}\n"
end
+
+ else
+ fail Gem::CommandLineError, "Unknown enviroment option [#{arg}]"
end
say out
true