def self.convert(fname, template, out = $stdout, nongem = true, local = false,
doc_subpackage = true)
package = Gem2Rpm::Package.new(fname)
format = Gem2Rpm::Format.new(package)
spec = Gem2Rpm::Specification.new(package.spec)
config = Configuration.instance.reset
runtime_dependencies = Gem2Rpm::RpmDependencyList.new(spec.runtime_dependencies)
development_dependencies = Gem2Rpm::RpmDependencyList.new(spec.development_dependencies)
tests = TestSuite.new(spec)
files = RpmFileList.new(spec.files)
main_files = files.top_level_entries.main_entries
doc_files = files.top_level_entries.doc_entries
download_path = ""
unless local
begin
download_path = find_download_url(spec.name, spec.version)
rescue DownloadUrlError => e
$stderr.puts "Warning: Could not retrieve full URL for #{spec.name}\nWarning: Edit the specfile and enter the full download URL as 'Source0' manually"
$stderr.puts e.inspect
end
end
erb = ERB.new(template.read, 0, '-')
out.puts erb.result(binding)
rescue Gem::Exception => e
puts e
end