The format class knows the guts of the RubyGem .gem file format and provides the capability to read gem files
Reads the named gem file and returns a Format object, representing the data from the gem file
file_path |
|
# File lib/rubygems/old_format.rb, line 37 def self.from_file_by_path(file_path) unless File.exist?(file_path) raise Gem::Exception, "Cannot load gem file [#{file_path}]" end File.open(file_path, 'rb') do |file| from_io(file, file_path) end end
Reads a gem from an io stream and returns a Format object, representing the data from the gem file
io |
|
# File lib/rubygems/old_format.rb, line 53 def self.from_io(io, gem_path="(io)") format = self.new(gem_path) skip_ruby(io) format.spec = read_spec(io) format.file_entries = [] read_files_from_gem(io) do |entry, file_data| format.file_entries << [entry, file_data] end format end
Constructs an instance of a Format object, representing the gem’s data structure.
gem |
|
# File lib/rubygems/old_format.rb, line 23 def initialize(gem_path) require 'fileutils' require 'zlib' Gem.load_yaml @gem_path = gem_path end
Generated with the Darkfish Rdoc Generator 2.