summaryrefslogtreecommitdiff
path: root/lib/rubygems/commands/unpack_command.rb
diff options
context:
space:
mode:
authorbronzdoc <lsagastume1990@gmail.com>2019-06-23 20:03:50 -0600
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2019-07-31 07:47:01 +0800
commit688ccc96020258acb4c02a2f8c5ff6e5a0bbc966 (patch)
tree932522a984f1a289a6c6fc9dadba8dbba524e069 /lib/rubygems/commands/unpack_command.rb
parent8103d46a4d9591ae95f9a3c31619d1b12031cf3c (diff)
[rubygems/rubygems] Move metadata method to Gem::Package
https://github.com/rubygems/rubygems/commit/2c9cfcb666
Diffstat (limited to 'lib/rubygems/commands/unpack_command.rb')
-rw-r--r--lib/rubygems/commands/unpack_command.rb30
1 files changed, 1 insertions, 29 deletions
diff --git a/lib/rubygems/commands/unpack_command.rb b/lib/rubygems/commands/unpack_command.rb
index 938db701e5..317fd44251 100644
--- a/lib/rubygems/commands/unpack_command.rb
+++ b/lib/rubygems/commands/unpack_command.rb
@@ -85,7 +85,7 @@ command help for an example.
end
if @options[:spec]
- spec, metadata = get_metadata path, security_policy
+ spec, metadata = Gem::Package.metadata(path, security_policy)
if metadata.nil?
alert_error "--spec is unsupported on '#{name}' (old format gem)"
@@ -173,32 +173,4 @@ command help for an example.
path
end
-
- ##
- # Extracts the Gem::Specification and raw metadata from the .gem file at
- # +path+.
- #--
- # TODO move to Gem::Package as #raw_spec or something
-
- def get_metadata(path, security_policy = nil)
- format = Gem::Package.new path, security_policy
- spec = format.spec
-
- metadata = nil
-
- File.open path, Gem.binary_mode do |io|
- tar = Gem::Package::TarReader.new io
- tar.each_entry do |entry|
- case entry.full_name
- when 'metadata' then
- metadata = entry.read
- when 'metadata.gz' then
- metadata = Gem::Util.gunzip entry.read
- end
- end
- end
-
- return spec, metadata
- end
-
end