summaryrefslogtreecommitdiff
path: root/lib/rubygems/commands/environment_command.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-09-13 19:58:57 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-09-13 19:58:57 +0000
commit1daa0b113d853bfa57b776cc569939b61ca14292 (patch)
treef8c4acb08a551820299dff2b13966d6ac38d31e4 /lib/rubygems/commands/environment_command.rb
parent85995e88d49c442b5b113c2676456133e79f5c02 (diff)
* lib/rubygems: Update to RubyGems 2.1.3
Fixed installing platform gems Restored concurrent requires Fixed installing gems with extensions with --install-dir Fixed `gem fetch -v` to install the latest version Fixed installing gems with "./" in their files entries * test/rubygems/test_gem_package.rb: Tests for the above. * NEWS: Updated for RubyGems 2.1.3 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42938 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/commands/environment_command.rb')
-rw-r--r--lib/rubygems/commands/environment_command.rb126
1 files changed, 53 insertions, 73 deletions
diff --git a/lib/rubygems/commands/environment_command.rb b/lib/rubygems/commands/environment_command.rb
index d32d12b757..40e71cf094 100644
--- a/lib/rubygems/commands/environment_command.rb
+++ b/lib/rubygems/commands/environment_command.rb
@@ -21,9 +21,6 @@ class Gem::Commands::EnvironmentCommand < Gem::Command
def description # :nodoc:
<<-EOF
-The environment command lets you query rubygems for its configuration for
-use in shell scripts or as a debugging aid.
-
The RubyGems environment can be controlled through command line arguments,
gemrc files, environment variables and built-in defaults.
@@ -72,83 +69,66 @@ lib/rubygems/defaults/operating_system.rb
def execute
out = ''
arg = options[:args][0]
- out <<
- case arg
- when /^packageversion/ then
- Gem::RubyGemsPackageVersion
- when /^version/ then
- Gem::VERSION
- when /^gemdir/, /^gemhome/, /^home/, /^GEM_HOME/ then
- Gem.dir
- when /^gempath/, /^path/, /^GEM_PATH/ then
- Gem.path.join(File::PATH_SEPARATOR)
- when /^remotesources/ then
- Gem.sources.to_a.join("\n")
- when /^platform/ then
- Gem.platforms.join(File::PATH_SEPARATOR)
- when nil then
- show_environment
- else
- raise Gem::CommandLineError, "Unknown environment option [#{arg}]"
+ case arg
+ when /^packageversion/ then
+ out << Gem::RubyGemsPackageVersion
+ when /^version/ then
+ out << Gem::VERSION
+ when /^gemdir/, /^gemhome/, /^home/, /^GEM_HOME/ then
+ out << Gem.dir
+ when /^gempath/, /^path/, /^GEM_PATH/ then
+ out << Gem.path.join(File::PATH_SEPARATOR)
+ when /^remotesources/ then
+ out << Gem.sources.to_a.join("\n")
+ when /^platform/ then
+ out << Gem.platforms.join(File::PATH_SEPARATOR)
+ when nil then
+ out = "RubyGems Environment:\n"
+
+ out << " - RUBYGEMS VERSION: #{Gem::VERSION}\n"
+
+ out << " - RUBY VERSION: #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}"
+ out << " patchlevel #{RUBY_PATCHLEVEL}" if defined? RUBY_PATCHLEVEL
+ out << ") [#{RUBY_PLATFORM}]\n"
+
+ out << " - INSTALLATION DIRECTORY: #{Gem.dir}\n"
+
+ out << " - RUBYGEMS PREFIX: #{Gem.prefix}\n" unless Gem.prefix.nil?
+
+ out << " - RUBY EXECUTABLE: #{Gem.ruby}\n"
+
+ out << " - EXECUTABLE DIRECTORY: #{Gem.bindir}\n"
+
+ out << " - RUBYGEMS PLATFORMS:\n"
+ Gem.platforms.each do |platform|
+ out << " - #{platform}\n"
end
- say out
- true
- end
-
- def add_path out, path
- path.each do |component|
- out << " - #{component}\n"
- end
- end
-
- def show_environment # :nodoc:
- out = "RubyGems Environment:\n"
-
- out << " - RUBYGEMS VERSION: #{Gem::VERSION}\n"
-
- out << " - RUBY VERSION: #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}"
- out << " patchlevel #{RUBY_PATCHLEVEL}" if defined? RUBY_PATCHLEVEL
- out << ") [#{RUBY_PLATFORM}]\n"
-
- out << " - INSTALLATION DIRECTORY: #{Gem.dir}\n"
-
- out << " - RUBYGEMS PREFIX: #{Gem.prefix}\n" unless Gem.prefix.nil?
-
- out << " - RUBY EXECUTABLE: #{Gem.ruby}\n"
- out << " - EXECUTABLE DIRECTORY: #{Gem.bindir}\n"
+ out << " - GEM PATHS:\n"
+ out << " - #{Gem.dir}\n"
- out << " - SPEC CACHE DIRECTORY: #{Gem.spec_cache_dir}\n"
-
- out << " - RUBYGEMS PLATFORMS:\n"
- Gem.platforms.each do |platform|
- out << " - #{platform}\n"
- end
-
- out << " - GEM PATHS:\n"
- out << " - #{Gem.dir}\n"
+ path = Gem.path.dup
+ path.delete Gem.dir
+ path.each do |p|
+ out << " - #{p}\n"
+ end
- gem_path = Gem.path.dup
- gem_path.delete Gem.dir
- add_path out, gem_path
+ out << " - GEM CONFIGURATION:\n"
+ Gem.configuration.each do |name, value|
+ value = value.gsub(/./, '*') if name == 'gemcutter_key'
+ out << " - #{name.inspect} => #{value.inspect}\n"
+ end
- out << " - GEM CONFIGURATION:\n"
- Gem.configuration.each do |name, value|
- value = value.gsub(/./, '*') if name == 'gemcutter_key'
- out << " - #{name.inspect} => #{value.inspect}\n"
- end
+ out << " - REMOTE SOURCES:\n"
+ Gem.sources.each do |s|
+ out << " - #{s}\n"
+ end
- out << " - REMOTE SOURCES:\n"
- Gem.sources.each do |s|
- out << " - #{s}\n"
+ else
+ raise Gem::CommandLineError, "Unknown environment option [#{arg}]"
end
-
- out << " - SHELL PATH:\n"
-
- shell_path = ENV['PATH'].split(File::PATH_SEPARATOR)
- add_path out, shell_path
-
- out
+ say out
+ true
end
end