summaryrefslogtreecommitdiff
path: root/lib/rubygems/commands/contents_command.rb
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-11-21 10:20:47 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-11-21 10:20:47 +0000
commit5335ce0e060c7a2a0b01c57f8f8a64254f2658e1 ()
treec63321cb7c7c5c15454a79d81123c7188be2c51e /lib/rubygems/commands/contents_command.rb
parent2f023c5dbaadede9ceac3eb9ac0e73f3050e5ada (diff)
Merge master branch from rubygems/rubygems upstream.
* Enable Style/MethodDefParentheses in Rubocop https://.com/rubygems/rubygems/pull/2478 * Enable Style/MultilineIfThen in Rubocop https://.com/rubygems/rubygems/pull/2479 * Fix required_ruby_version with prereleases and improve error message https://.com/rubygems/rubygems/pull/2344 * Fix bundler rubygems binstub not properly looking for bundler https://.com/rubygems/rubygems/pull/2426 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65904 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--lib/rubygems/commands/contents_command.rb29
1 files changed, 14 insertions, 15 deletions
@@ -73,7 +73,7 @@ prefix or only the files that are requireable.
names.each do |name|
found =
- if options[:show_install_dir] then
gem_install_dir name
else
gem_contents name
@@ -83,15 +83,15 @@ prefix or only the files that are requireable.
end
end
- def files_in spec
- if spec.default_gem? then
files_in_default_gem spec
else
files_in_gem spec
end
end
- def files_in_gem spec
gem_path = spec.full_gem_path
extra = "/{#{spec.require_paths.join ','}}" if options[:lib_only]
glob = "#{gem_path}#{extra}/**/*"
@@ -102,7 +102,7 @@ prefix or only the files that are requireable.
end
end
- def files_in_default_gem spec
spec.files.map do |file|
case file
when /\A#{spec.bindir}\//
@@ -115,7 +115,7 @@ prefix or only the files that are requireable.
end
end
- def gem_contents name
spec = spec_for name
return false unless spec
@@ -127,7 +127,7 @@ prefix or only the files that are requireable.
true
end
- def gem_install_dir name
spec = spec_for name
return false unless spec
@@ -138,27 +138,27 @@ prefix or only the files that are requireable.
end
def gem_names # :nodoc:
- if options[:all] then
Gem::Specification.map(&:name)
else
get_all_gem_names
end
end
- def path_description spec_dirs # :nodoc:
- if spec_dirs.empty? then
"default gem paths"
else
"specified path"
end
end
- def show_files files
files.sort.each do |prefix, basename|
absolute_path = File.join(prefix, basename)
next if File.directory? absolute_path
- if options[:prefix] then
say absolute_path
else
say basename
@@ -166,14 +166,14 @@ prefix or only the files that are requireable.
end
end
- def spec_for name
spec = Gem::Specification.find_all_by_name(name, @version).last
return spec if spec
say "Unable to find gem '#{name}' in #{@path_kind}"
- if Gem.configuration.verbose then
say "\nDirectories searched:"
@spec_dirs.sort.each { |dir| say dir }
end
@@ -188,4 +188,3 @@ prefix or only the files that are requireable.
end
end
-