module Polisher::Git::PkgRepo

Public Instance Methods

clone() click to toggle source

Override clone to use PKG_PCMD @override

# File lib/polisher/git/pkg/repo.rb, line 17
def clone
  require_dep! 'awesome_spawn'
  require_cmd! pkg_cmd

  clobber!
  Dir.mkdir path unless File.directory? path
  in_repo do
    result = AwesomeSpawn.run "#{pkg_cmd} clone #{rpm_name}"
    raise PolisherError,
          "could not clone #{rpm_name}" unless result.exit_status == 0

    # pkg_cmd will clone into the rpm_name subdir,
    # move everything up a dir
    Dir.foreach("#{rpm_name}/") do |f|
      orig = "#{rpm_name}/#{f}"
      skip = ['.', '..'].include?(f)
      FileUtils.move orig, '.' unless skip
    end

    FileUtils.rm_rf rpm_name
  end

  self
end
Also aliased as: git_clone
commit(msg = nil) click to toggle source

Override commit, generate a default msg, always add pkg files @override

Calls superclass method
# File lib/polisher/git/pkg/repo.rb, line 72
def commit(msg = nil)
  require_dep! 'awesome_spawn'
  require_cmd! git_cmd

  in_repo { AwesomeSpawn.run "#{git_cmd} add #{pkg_files.join(' ')}" }
  super(msg.nil? ? "updated to #{version}" : msg)
  self
end
fetch(target = nil) click to toggle source

Fetch specified target or configured fetch_tgt if not specified

# File lib/polisher/git/pkg/repo.rb, line 43
def fetch(target = nil)
  target = self.class.fetch_tgts.first if target.nil?
  clone unless cloned?
  raise Exception, "Dead package detected" if dead?
  checkout target
  reset!
  pull

  self
end
git_clone()

Alias orig clone method to git_clone

Alias for: clone
valid_branches()
Alias for: valid_targets
valid_targets() click to toggle source

Return the valid targets, eg those which we can fetch

# File lib/polisher/git/pkg/repo.rb, line 55
def valid_targets
  valid = []
  self.class.fetch_tgts.collect do |target|
    begin
      fetch target
      valid << target
    rescue
      # noop
    end
  end
  valid
end
Also aliased as: valid_branches