mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
e548c09d42
commit
4de117a615
153 changed files with 5400 additions and 981 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue