# File lib/gem2rpm.rb, line 37 def Gem2Rpm.convert(fname, template=TEMPLATE, out=$stdout, nongem=true, local=false, doc_subpackage = true, oldlicense=nil) format = Gem::Format.from_file_by_path(fname) spec = Gem2Rpm::Specification.new(format.spec) download_path = "" if spec.licenses.empty? && oldlicense spec.licenses = oldlicense.split(' and ') end unless local begin download_path = find_download_url(spec.name, spec.version) rescue Gem::Exception => 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 template = ERB.new(template, 0, '-') out.puts template.result(binding) rescue Gem::Exception => e puts e end
# File lib/gem2rpm.rb, line 21 def self.find_download_url(name, version) installer = Gem::RemoteInstaller.new dummy, download_path = installer.find_gem_to_install(name, "=#{version}") download_path += "/gems/" if download_path.to_s != "" return download_path end
Returns the email address of the packager (i.e., the person running gem2spec). Taken from RPM macros if present, constructed from system username and hostname otherwise.
# File lib/gem2rpm.rb, line 62 def Gem2Rpm.packager() packager = `rpmdev-packager`.chomp if packager.empty? packager = `rpm --eval '%{packager}'`.chomp end if packager.empty? or packager == '%{packager}' packager = "#{Etc::getpwnam(Etc::getlogin).gecos} <#{Etc::getlogin}@#{Socket::gethostname}>" end packager end
Generated with the Darkfish Rdoc Generator 2.