Sha256: 9d38551e7de29d944dfa2981e74bae589ab89f807510f2fc9cca5494966b59d3

Contents?: true

Size: 1.48 KB

Versions: 3

Compression:

Stored size: 1.48 KB

Contents

# Polisher Fedora Operations
#
# Licensed under the MIT license
# Copyright (C) 2013-2014 Red Hat, Inc.

require 'curb'
require 'pkgwat'

require 'polisher/bodhi'

module Polisher
  class Fedora
    PACKAGE_LIST = 'https://admin.fedoraproject.org/pkgdb/users/packages/'

    def self.client
      @client ||= Curl::Easy.new
    end

    # Retrieve list of gems owned by the specified user
    #
    # @param [String] user Fedora username to lookup
    # @return [Array<String>] list of gems which the user owns/has access to
    def self.gems_owned_by(user)
      client.url = "#{PACKAGE_LIST}#{user}"
      client.http_get
      packages = client.body_str
      # TODO instantiate Polisher::Gem instances & return
      Nokogiri::HTML(packages).xpath("//a[@class='PackageName']").
                               select { |i| i.text =~ /rubygem-.*/ }.
                               collect { |i| i.text.gsub(/rubygem-/, '') }
    end

    # Retrieve list of the versions of the specified package in the various
    # Fedora releases.
    #
    # @param [String] name name of the package to lookup
    # @param [Callable] bl optional callback to invoke with versions retrieved
    # @return [Array<String>] list of versions in Fedora
    def self.versions_for(name, &bl)
      # simply dispatch to bodhi to get latest updates
      Polisher::Bodhi.versions_for name do |target,name,versions|
        bl.call(:fedora, name, versions) unless(bl.nil?) 
      end
    end
  end # class Fedora
end # module Polisher

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
polisher-0.9.1 lib/polisher/fedora.rb
polisher-0.8.1 lib/polisher/fedora.rb
polisher-0.7.1 lib/polisher/fedora.rb