module Polisher::GemState

Public Instance Methods

distgit() click to toggle source
# File lib/polisher/gem/state.rb, line 27
def distgit
  @distgit ||= Git::Pkg.new :name => name
end
distgit_branches() click to toggle source
# File lib/polisher/gem/state.rb, line 31
def distgit_branches
  tags = []

  koji_tags.each do |tag, _version|
    tag = TagMapper.map(tag)
    tags << tag unless tag.nil?
  end

  tags.empty? ? distgit.valid_branches : tags
end
distgit_state(args = {}) click to toggle source
# File lib/polisher/gem/state.rb, line 49
def distgit_state(args = {})
  check_dep = args.key?(:check)

  begin
    distgit.clone
  rescue
    return :missing_repo
  end

  return :missing_branch if distgit.valid_branches.empty?
  return :missing_spec   if distgit_versions.empty?
  return :available      unless check_dep

  distgit_versions.each do |version|
    return :available if args[:check].match?(name, version)
  end

  return :missing
end
distgit_versions() click to toggle source
# File lib/polisher/gem/state.rb, line 42
def distgit_versions
  distgit_branches.collect do |branch|
    distgit.fetch branch
    distgit.spec.version if distgit.spec?
  end.compact
end
koji_state(args = {}) click to toggle source
# File lib/polisher/gem/state.rb, line 14
def koji_state(args = {})
  check_dep = args.key?(:check)

  return :missing   if koji_tags.empty?
  return :available unless check_dep

  koji_tags.each do |_tag, version|
    return :available if !version.nil? && args[:check].match?(name, version)
  end

  return :missing
end
koji_tags() click to toggle source
# File lib/polisher/gem/state.rb, line 10
def koji_tags
  Koji.tagged_version_for(name)
end
state(args = {}) click to toggle source

Return the ‘state’ of the gem as inferred by the targets which there are versions for.

If optional :check argument is specified, version analysis will be restricted to targets satisfying the specified gem dependency requirements

# File lib/polisher/gem/state.rb, line 75
def state(args = {})
  return :available if koji_state(args) == :available

  state = distgit_state(args)
  return :needs_repo   if state == :missing_repo
  return :needs_branch if state == :missing_branch
  return :needs_spec   if state == :missing_spec
  return :needs_build  if state == :available
  return :needs_update
end