summaryrefslogtreecommitdiff
path: root/lib/rubygems/commands/contents_command.rb
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-14 03:30:02 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-14 03:30:02 +0000
commit4de117a61517e839f2c45eaf45d56fc243d6d5b2 (patch)
tree7cb5af7a7eb513e5dddf5e343746b1611e628387 /lib/rubygems/commands/contents_command.rb
parente548c09d429a5136285ea81aed418685359ed124 (diff)
* lib/rubygems: Update to RubyGems 2.4.1 master(713ab65)
Complete history at: https://github.com/rubygems/rubygems/blob/master/History.txt#L3-L216 * test/rubygems: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47582 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/commands/contents_command.rb')
-rw-r--r--lib/rubygems/commands/contents_command.rb25
1 files changed, 23 insertions, 2 deletions
diff --git a/lib/rubygems/commands/contents_command.rb b/lib/rubygems/commands/contents_command.rb
index 603f1d072a..15657f31a2 100644
--- a/lib/rubygems/commands/contents_command.rb
+++ b/lib/rubygems/commands/contents_command.rb
@@ -8,7 +8,8 @@ class Gem::Commands::ContentsCommand < Gem::Command
def initialize
super 'contents', 'Display the contents of the installed gems',
- :specdirs => [], :lib_only => false, :prefix => true
+ :specdirs => [], :lib_only => false, :prefix => true,
+ :show_install_dir => false
add_version_option
@@ -32,6 +33,11 @@ class Gem::Commands::ContentsCommand < Gem::Command
options[:prefix] = prefix
end
+ add_option( '--[no-]show-install-dir',
+ 'Show only the gem install dir') do |show, options|
+ options[:show_install_dir] = show
+ end
+
@path_kind = nil
@spec_dirs = nil
@version = nil
@@ -65,7 +71,12 @@ prefix or only the files that are requireable.
names = gem_names
names.each do |name|
- found = gem_contents name
+ found =
+ if options[:show_install_dir] then
+ gem_install_dir name
+ else
+ gem_contents name
+ end
terminate_interaction 1 unless found or names.length > 1
end
@@ -115,6 +126,16 @@ prefix or only the files that are requireable.
true
end
+ def gem_install_dir name
+ spec = spec_for name
+
+ return false unless spec
+
+ say spec.gem_dir
+
+ true
+ end
+
def gem_names # :nodoc:
if options[:all] then
Gem::Specification.map(&:name)