summaryrefslogtreecommitdiff
path: root/lib/rubygems/commands/contents_command.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rubygems/commands/contents_command.rb')
-rw-r--r--lib/rubygems/commands/contents_command.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/rubygems/commands/contents_command.rb b/lib/rubygems/commands/contents_command.rb
index c5fdfca31e..f3783468aa 100644
--- a/lib/rubygems/commands/contents_command.rb
+++ b/lib/rubygems/commands/contents_command.rb
@@ -1,4 +1,5 @@
# frozen_string_literal: true
+
require_relative "../command"
require_relative "../version_option"
@@ -91,9 +92,9 @@ prefix or only the files that are requireable.
def files_in_gem(spec)
gem_path = spec.full_gem_path
- extra = "/{#{spec.require_paths.join ','}}" if options[:lib_only]
+ extra = "/{#{spec.require_paths.join ","}}" if options[:lib_only]
glob = "#{gem_path}#{extra}/**/*"
- prefix_re = /#{Regexp.escape(gem_path)}\//
+ prefix_re = %r{#{Regexp.escape(gem_path)}/}
Dir[glob].map do |file|
[gem_path, file.sub(prefix_re, "")]
@@ -103,7 +104,7 @@ prefix or only the files that are requireable.
def files_in_default_gem(spec)
spec.files.map do |file|
case file
- when /\A#{spec.bindir}\//
+ when %r{\A#{spec.bindir}/}
# $' is POSTMATCH
[RbConfig::CONFIG["bindir"], $']
when /\.so\z/
@@ -177,7 +178,7 @@ prefix or only the files that are requireable.
@spec_dirs.sort.each {|dir| say dir }
end
- return nil
+ nil
end
def specification_directories # :nodoc: