Reads the specification YAML from the supplied IO and constructs a Gem::Specification from it. After
calling this method, the IO index will be set after
the specification header.
# File lib/rubygems/old_format.rb, line 94
def self.read_spec(file)
yaml = ''
read_until_dashes file do |line|
yaml << line
end
Gem::Specification.from_yaml yaml
rescue YAML::Error => e
raise Gem::Exception, "Failed to parse gem specification out of gem file"
rescue ArgumentError => e
raise Gem::Exception, "Failed to parse gem specification out of gem file"
end