fyi 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.4
1
+ 1.0.5
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{fyi}
8
- s.version = "1.0.4"
8
+ s.version = "1.0.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Andy Stewart"]
12
- s.date = %q{2009-12-23}
12
+ s.date = %q{2010-01-07}
13
13
  s.default_executable = %q{fyi}
14
14
  s.email = %q{boss@airbladesoftware.com}
15
15
  s.executables = ["fyi"]
data/lib/fyi.rb CHANGED
@@ -41,8 +41,9 @@ class Fyi
41
41
  end
42
42
 
43
43
  def notify result, duration, output, error = ''
44
+ host = `hostname` || 'unknown'
44
45
  notifiers.each do |notifier|
45
- notifier.notify @command, result, duration, output, error
46
+ notifier.notify @command, result, duration, output, error, host
46
47
  end
47
48
  end
48
49
 
@@ -37,8 +37,8 @@ class Fyi
37
37
  @on_failure = options.has_key?('on_failure') ? options['on_failure'] : true
38
38
  end
39
39
 
40
- def notify command, result, duration, output, error = ''
41
- send_email(command, result, duration, output, error) if should_notify?(result)
40
+ def notify command, result, duration, output, error = '', host = ''
41
+ send_email(command, result, duration, output, error, host) if should_notify?(result)
42
42
  end
43
43
 
44
44
  private
@@ -47,11 +47,11 @@ class Fyi
47
47
  (result == :success && @on_success) || (result == :failure && @on_failure)
48
48
  end
49
49
 
50
- def send_email command, result, duration, output, error
50
+ def send_email command, result, duration, output, error, host
51
51
  Pony.mail :to => @to,
52
52
  :from => @from,
53
53
  :subject => subject(command, result),
54
- :body => body(command, duration, output, error),
54
+ :body => body(command, duration, output, error, host),
55
55
  :via => :smtp,
56
56
  :smtp => @smtp
57
57
  end
@@ -60,8 +60,10 @@ class Fyi
60
60
  "[#{result.to_s.upcase}] #{truncate command}"
61
61
  end
62
62
 
63
- def body command, duration, output, error
63
+ def body command, duration, output, error, host
64
64
  <<END
65
+ host: #{host}
66
+
65
67
  command: #{command}
66
68
 
67
69
  duration: #{duration}s
@@ -17,8 +17,8 @@ class Fyi
17
17
  @logger = Logger.new log_file
18
18
  end
19
19
 
20
- def notify command, result, duration, output, error = ''
21
- logger.log severity(result), message(command, result, duration, output, error)
20
+ def notify command, result, duration, output, error = '', host = ''
21
+ logger.log severity(result), message(command, result, duration, output, error, host)
22
22
  end
23
23
 
24
24
  private
@@ -27,8 +27,9 @@ class Fyi
27
27
  result == :success ? Logger::INFO : Logger::WARN
28
28
  end
29
29
 
30
- def message command, result, duration, output, error
30
+ def message command, result, duration, output, error, host
31
31
  <<END
32
+ host: #{host}
32
33
  command: #{command}
33
34
  duration: #{duration}s
34
35
  status: #{result.to_s.upcase}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fyi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Stewart
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-23 00:00:00 +00:00
12
+ date: 2010-01-07 00:00:00 +00:00
13
13
  default_executable: fyi
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency