In Files

Files

Class/Module Index [+]

Quicksearch

Gem2Rpm5

Constants

TEMPLATE
VERSION

Public Class Methods

convert(fname, template=TEMPLATE, out=$stdout, nongem=true, local=false) click to toggle source
# File lib/gem2rpm5.rb, line 62
def Gem2Rpm5.convert(fname, template=TEMPLATE, out=$stdout,
                    nongem=true, local=false)
  format = Gem::Format.from_file_by_path(fname)
  spec = format.spec
  spec.description ||= spec.summary
  download_path = "http://gems.rubyforge.org/gems/"
  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)
end
find_download_url(name, version) click to toggle source
# File lib/gem2rpm5.rb, line 46
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
packager() click to toggle source

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/gem2rpm5.rb, line 83
def Gem2Rpm5.packager()
  packager = `rpm --eval '%{packager}'`.chomp
  if packager == '' or packager == '%{packager}'
    packager = "#{Etc::getpwnam(Etc::getlogin).gecos} <#{Etc::getlogin}@#{Socket::gethostname}>"
  end
  packager
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.