From 63d93888209ee3dd1a68ff708d4e152838117b21 Mon Sep 17 00:00:00 2001 From: Jared Fraser Date: Thu, 7 Jan 2010 10:47:27 +1100 Subject: [PATCH 1/3] Version bump to 1.0.5 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index ee90284..90a27f9 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0.4 +1.0.5 From 6f94c7af96962285ae5d0ba36e1f3bcb44e6011c Mon Sep 17 00:00:00 2001 From: Jared Fraser Date: Thu, 7 Jan 2010 11:34:39 +1100 Subject: [PATCH 2/3] Added hostname to fyi notifications to allow the origin to be recorded --- fyi.gemspec | 7 +++---- lib/fyi.rb | 3 ++- lib/fyi/notifiers/email.rb | 12 +++++++----- lib/fyi/notifiers/log.rb | 7 ++++--- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/fyi.gemspec b/fyi.gemspec index 26eaee8..4846f9e 100644 --- a/fyi.gemspec +++ b/fyi.gemspec @@ -1,15 +1,15 @@ # Generated by jeweler # DO NOT EDIT THIS FILE DIRECTLY -# Instead, edit Jeweler::Tasks in rakefile, and run the gemspec command +# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = %q{fyi} - s.version = "1.0.4" + s.version = "1.0.5" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.authors = ["Andy Stewart"] - s.date = %q{2009-12-23} + s.date = %q{2010-01-07} s.default_executable = %q{fyi} s.email = %q{boss@airbladesoftware.com} s.executables = ["fyi"] @@ -22,7 +22,6 @@ Gem::Specification.new do |s| "Rakefile", "VERSION", "bin/fyi", - "config_example.yml", "fyi.gemspec", "lib/fyi.rb", "lib/fyi/config.rb", diff --git a/lib/fyi.rb b/lib/fyi.rb index 587d123..5641d0e 100644 --- a/lib/fyi.rb +++ b/lib/fyi.rb @@ -41,8 +41,9 @@ def run_failed output, error end def notify result, duration, output, error = '' + host = `hostname` || 'unknown' notifiers.each do |notifier| - notifier.notify @command, result, duration, output, error + notifier.notify @command, result, duration, output, error, host end end diff --git a/lib/fyi/notifiers/email.rb b/lib/fyi/notifiers/email.rb index 57ec2f8..89e0ee5 100644 --- a/lib/fyi/notifiers/email.rb +++ b/lib/fyi/notifiers/email.rb @@ -37,8 +37,8 @@ def initialize options @on_failure = options.has_key?('on_failure') ? options['on_failure'] : true end - def notify command, result, duration, output, error = '' - send_email(command, result, duration, output, error) if should_notify?(result) + def notify command, result, duration, output, error = '', host = '' + send_email(command, result, duration, output, error, host) if should_notify?(result) end private @@ -47,11 +47,11 @@ def should_notify?(result) (result == :success && @on_success) || (result == :failure && @on_failure) end - def send_email command, result, duration, output, error + def send_email command, result, duration, output, error, host Pony.mail :to => @to, :from => @from, :subject => subject(command, result), - :body => body(command, duration, output, error), + :body => body(command, duration, output, error, host), :via => :smtp, :smtp => @smtp end @@ -60,8 +60,10 @@ def subject command, result "[#{result.to_s.upcase}] #{truncate command}" end - def body command, duration, output, error + def body command, duration, output, error, host < Date: Mon, 11 Jan 2010 09:12:24 +1100 Subject: [PATCH 3/3] Removed redundant fallback for hostname call --- lib/fyi.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/fyi.rb b/lib/fyi.rb index 5641d0e..adb02bd 100644 --- a/lib/fyi.rb +++ b/lib/fyi.rb @@ -41,7 +41,7 @@ def run_failed output, error end def notify result, duration, output, error = '' - host = `hostname` || 'unknown' + host = `hostname` notifiers.each do |notifier| notifier.notify @command, result, duration, output, error, host end