summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
-rw-r--r--lib/rubygems/commands/unpack_command.rb30
-rw-r--r--lib/rubygems/package.rb27
2 files changed, 27 insertions, 30 deletions
@@ -85,7 +85,7 @@ command help for an example.
end
if @options[:spec]
- spec, metadata = get_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
@@ -157,6 +157,32 @@ class Gem::Package
end
##
# Creates a new package that will read or write to the file +gem+.
def initialize(gem, security_policy) # :notnew:
@@ -690,7 +716,6 @@ EOM
rescue Zlib::GzipFile::Error => e
raise Gem::Package::FormatError.new(e.message, entry.full_name)
end
-
end
require 'rubygems/package/digest_io'