From 96d2efa8ed31e1ea22674c3195c589eb15d584dc Mon Sep 17 00:00:00 2001 From: Saku Ytti Date: Wed, 25 Nov 2015 11:16:48 +0200 Subject: add placeholder 'version' method for file output --- lib/oxidized/output/file.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/oxidized/output') diff --git a/lib/oxidized/output/file.rb b/lib/oxidized/output/file.rb index 38c9917..3326a32 100644 --- a/lib/oxidized/output/file.rb +++ b/lib/oxidized/output/file.rb @@ -39,5 +39,9 @@ class OxidizedFile < Output end end + def version node, group + 'not implemented for file output' + end + end end -- cgit v1.2.1 From 4e23b4341cec6a1c4e7526bd3acafbe66c624fc5 Mon Sep 17 00:00:00 2001 From: Saku Ytti Date: Tue, 1 Dec 2015 11:21:47 +0200 Subject: meh further hack not to barf on version for files --- lib/oxidized/output/file.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib/oxidized/output') diff --git a/lib/oxidized/output/file.rb b/lib/oxidized/output/file.rb index 3326a32..d1a8c17 100644 --- a/lib/oxidized/output/file.rb +++ b/lib/oxidized/output/file.rb @@ -40,7 +40,12 @@ class OxidizedFile < Output end def version node, group - 'not implemented for file output' + # not supported + [] + end + + def get_version node, group, oid + 'not supported' end end -- cgit v1.2.1 From 201c02551d96a070f8d55936aba350f772649465 Mon Sep 17 00:00:00 2001 From: Nick Hilliard Date: Sun, 27 Dec 2015 18:19:36 +0000 Subject: expose git repo name and commit oid in hook mechanism and environment variables --- lib/oxidized/output/file.rb | 3 +++ lib/oxidized/output/git.rb | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'lib/oxidized/output') 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, -- cgit v1.2.1