| Class | Gem::OldFormat |
| In: |
lib/rubygems/old_format.rb
|
| Parent: | Object |
The format class knows the guts of the RubyGem .gem file format and provides the capability to read gem files
| file_entries | [RW] | |
| gem_path | [RW] | |
| spec | [RW] |
Reads the named gem file and returns a Format object, representing the data from the gem file
| file_path: | [String] Path to the gem file |
# File lib/rubygems/old_format.rb, line 36
36: def self.from_file_by_path(file_path)
37: unless File.exist?(file_path)
38: raise Gem::Exception, "Cannot load gem file [#{file_path}]"
39: end
40:
41: File.open(file_path, 'rb') do |file|
42: from_io(file, file_path)
43: end
44: end
Reads a gem from an io stream and returns a Format object, representing the data from the gem file
| io: | [IO] Stream from which to read the gem |
# File lib/rubygems/old_format.rb, line 52
52: def self.from_io(io, gem_path="(io)")
53: format = self.new(gem_path)
54: skip_ruby(io)
55: format.spec = read_spec(io)
56: format.file_entries = []
57: read_files_from_gem(io) do |entry, file_data|
58: format.file_entries << [entry, file_data]
59: end
60: format
61: end