| 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 37
37: def self.from_file_by_path(file_path)
38: unless File.exist?(file_path)
39: raise Gem::Exception, "Cannot load gem file [#{file_path}]"
40: end
41:
42: File.open(file_path, 'rb') do |file|
43: from_io(file, file_path)
44: end
45: 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 53
53: def self.from_io(io, gem_path="(io)")
54: format = self.new(gem_path)
55: skip_ruby(io)
56: format.spec = read_spec(io)
57: format.file_entries = []
58: read_files_from_gem(io) do |entry, file_data|
59: format.file_entries << [entry, file_data]
60: end
61: format
62: end