From 8cc45aae947d453acca029e13eb64f3f5f0bf942 Mon Sep 17 00:00:00 2001 From: drbrain Date: Mon, 31 Mar 2008 22:40:06 +0000 Subject: Import RubyGems 1.1.0 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/rubygems/commands/environment_command.rb | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'lib/rubygems/commands/environment_command.rb') 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 -- cgit v1.2.3