Class: RepoMgr::Publisher::Git
- Inherits:
-
Object
- Object
- RepoMgr::Publisher::Git
- Defined in:
- lib/repo_mgr/publishers/git.rb
Overview
git publisher
Instance Method Summary collapse
-
#initialize(config) ⇒ Git
constructor
A new instance of Git.
-
#save(repo, pkg) ⇒ Object
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.
-
#sync(repo) ⇒ Object
method invoked when the local deb/rpm repository is published for git, this is pushing to a remote.
Constructor Details
#initialize(config) ⇒ Git
Returns a new instance of Git.
9 10 11 |
# File 'lib/repo_mgr/publishers/git.rb', line 9 def initialize(config) @config = config end |
Instance Method Details
#save(repo, pkg) ⇒ Object
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
16 17 18 19 20 |
# 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) ⇒ Object
method invoked when the local deb/rpm repository is published for git, this is pushing to a remote
24 25 26 27 |
# 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 |