class RepoMgr::Publisher::Git

git publisher

Public Class Methods

new(config) click to toggle source
# File lib/repo_mgr/publishers/git.rb, line 9
def initialize(config)
  @config = config
end

Public Instance Methods

save(repo, pkg) click to toggle source

method invoked when the local deb/rpm repository is built for git, this requires a commit into the target git repository which is the target for deb/rpm repository export

# File lib/repo_mgr/publishers/git.rb, line 16
def save(repo, pkg)
  git = ::Git.open @config.cfg[:repos][repo][:path]
  git.add(all: true)
  git.commit "Add #{File.basename(pkg)}."
end
sync(repo) click to toggle source

method invoked when the local deb/rpm repository is published for git, this is pushing to a remote

# File lib/repo_mgr/publishers/git.rb, line 24
def sync(repo)
  git = ::Git.open @config.cfg[:repos][repo][:path]
  git.push(git.remote('origin'), 'main')
end