rhomobile-cijoe 0.2.7 → 0.2.8

Sign up to get free protection for your applications and to get access to all the features.
data/lib/cijoe.rb CHANGED
@@ -95,7 +95,16 @@ class CIJoe
95
95
  end
96
96
  clean_builds
97
97
 
98
- @old_builds[0].notify if @old_builds[0].respond_to? :notify
98
+ # Send email notifications if this build failed, or this build
99
+ # worked after the last one failed
100
+ if @old_builds[0].failed?
101
+ @old_builds[0].notify_fail
102
+ end
103
+
104
+ if @old_builds[0].worked? && @old_builds[1].failed?
105
+ @old_builds[0].notify_recover
106
+ end
107
+
99
108
  end
100
109
 
101
110
  # run the build but make sure only
data/lib/cijoe/email.rb CHANGED
@@ -3,6 +3,9 @@ require File.dirname(__FILE__) + '/../mmmail'
3
3
  class CIJoe
4
4
  module Email
5
5
  def self.activate
6
+
7
+ # If the user supplied a valid email configuration, make the Build module
8
+ # include this Email module
6
9
  if valid_config?
7
10
  CIJoe::Build.class_eval do
8
11
  include CIJoe::Email
@@ -39,14 +42,24 @@ class CIJoe
39
42
  end
40
43
  end
41
44
 
42
- def notify
43
- options = {
45
+ def notify_fail
46
+ fail_options = {
44
47
  :to => Email.config[:to],
45
48
  :from => Email.config[:to],
46
49
  :subject => "(#{project}) Build failed",
47
- :body => mail_body
50
+ :body => "The commit '#{commit.message}' (#{commit.url}) by #{commit.author} caused the build to fail.\n\nFail log:\n\n#{faillog}"
48
51
  }
49
- MmMail.mail(options, mail_config) if failed?
52
+ MmMail.mail(fail_options, mail_config)
53
+ end
54
+
55
+ def notify_recover
56
+ recover_options = {
57
+ :to => Email.config[:to],
58
+ :from => Email.config[:to],
59
+ :subject => "(#{project}) Build recovered",
60
+ :body => "The commit '#{commit.message}' (#{commit.url}) by #{commit.author} fixed the build."
61
+ }
62
+ MmMail.mail(recover_options, mail_config)
50
63
  end
51
64
 
52
65
  def mail_config
@@ -59,9 +72,5 @@ class CIJoe
59
72
  config
60
73
  end
61
74
 
62
- def mail_body
63
- body = "The commit '#{commit.message}' (#{commit.url}) by #{commit.author} caused the build to fail."
64
- body += "\n\nFail log:\n\n#{faillog}"
65
- end
66
75
  end
67
76
  end
data/lib/cijoe/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class CIJoe
2
- Version = "0.2.7"
2
+ Version = "0.2.8"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rhomobile-cijoe
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 7
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 7
10
- version: 0.2.7
9
+ - 8
10
+ version: 0.2.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - Chris Wanstrath
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2010-07-13 00:00:00 -07:00
20
+ date: 2010-07-15 00:00:00 -07:00
21
21
  default_executable: cijoe
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency