summaryrefslogtreecommitdiff
path: root/lib/oxidized/output
diff options
context:
space:
mode:
authorNick Hilliard <nick@foobar.org>2015-12-27 18:19:36 +0000
committerNick Hilliard <nick@foobar.org>2015-12-27 18:19:36 +0000
commit201c02551d96a070f8d55936aba350f772649465 (patch)
treec188329c2528681af35835391d5df9c208bab39f /lib/oxidized/output
parent6a09fc99989d9282d938e7dc2d48a30ad6ef9ad6 (diff)
expose git repo name and commit oid in hook mechanism and environment variables
Diffstat (limited to 'lib/oxidized/output')
-rw-r--r--lib/oxidized/output/file.rb3
-rw-r--r--lib/oxidized/output/git.rb7
2 files changed, 8 insertions, 2 deletions
diff --git a/lib/oxidized/output/file.rb b/lib/oxidized/output/file.rb
index d1a8c17..eb915c3 100644
--- a/lib/oxidized/output/file.rb
+++ b/lib/oxidized/output/file.rb
@@ -2,6 +2,8 @@ module Oxidized
class OxidizedFile < Output
require 'fileutils'
+ attr_reader :commitref
+
def initialize
@cfg = CFG.output.file
end
@@ -22,6 +24,7 @@ class OxidizedFile < Output
FileUtils.mkdir_p file
file = File.join file, node
open(file, 'w') { |fh| fh.write outputs.to_cfg }
+ @commitref = file
end
def fetch node, group
diff --git a/lib/oxidized/output/git.rb b/lib/oxidized/output/git.rb
index 3757cfc..fff3941 100644
--- a/lib/oxidized/output/git.rb
+++ b/lib/oxidized/output/git.rb
@@ -7,6 +7,8 @@ class Git < Output
raise OxidizedError, 'rugged not found: sudo gem install rugged'
end
+ attr_reader :commitref
+
def initialize
@cfg = CFG.output.git
end
@@ -27,6 +29,7 @@ class Git < Output
@user = (opt[:user] or @cfg.user)
@email = (opt[:email] or @cfg.email)
@opt = opt
+ @commitref = nil
repo = @cfg.repo
outputs.types.each do |type|
@@ -63,7 +66,7 @@ class Git < Output
end
end
- #give a hash of all oid revision for the givin node, and the date of the commit
+ #give a hash of all oid revision for the given node, and the date of the commit
def version node, group
begin
repo = @cfg.repo
@@ -176,7 +179,7 @@ class Git < Output
if tree_old != tree_new
repo.config['user.name'] = user
repo.config['user.email'] = email
- Rugged::Commit.create(repo,
+ @commitref = Rugged::Commit.create(repo,
:tree => index.write_tree(repo),
:message => msg,
:parents => repo.empty? ? [] : [repo.head.target].compact,