summaryrefslogtreecommitdiff
path: root/lib/oxidized/hook
diff options
context:
space:
mode:
Diffstat (limited to 'lib/oxidized/hook')
-rw-r--r--lib/oxidized/hook/githubrepo.rb13
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/oxidized/hook/githubrepo.rb b/lib/oxidized/hook/githubrepo.rb
index d10b51e..7fc6677 100644
--- a/lib/oxidized/hook/githubrepo.rb
+++ b/lib/oxidized/hook/githubrepo.rb
@@ -1,12 +1,12 @@
class GithubRepo < Oxidized::Hook
def validate_cfg!
- cfg.has_key?('remote_repo') or raise KeyError, 'remote_repo is required'
+ raise KeyError, 'hook.remote_repo is required' unless cfg.has_key?('remote_repo')
end
def run_hook(ctx)
- repo = Rugged::Repository.new(Oxidized.config.output.git.repo)
+ repo = Rugged::Repository.new(ctx.node.repo)
log "Pushing local repository(#{repo.path})..."
- remote = repo.remotes['origin'] || repo.remotes.create('origin', cfg.remote_repo)
+ remote = repo.remotes['origin'] || repo.remotes.create('origin', remote_repo(ctx.node))
log "to remote: #{remote.url}"
fetch_and_merge_remote(repo)
@@ -54,4 +54,11 @@ class GithubRepo < Oxidized::Hook
end
end
+ def remote_repo(node)
+ if node.group.nil? || cfg.remote_repo.is_a?(String)
+ cfg.remote_repo
+ else
+ cfg.remote_repo[node.group]
+ end
+ end
end