summaryrefslogtreecommitdiff
path: root/lib/rubygems/commands/unpack_command.rb
diff options
context:
space:
mode:
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