Browse files

Add the :fixed status and stop firing email on consecutive success bu…

…ilds
  • Loading branch information...
1 parent 139a67f commit 57ffa2780850dd8dc29d019af1172fc71e1f730a @byroot byroot committed Mar 19, 2013
Showing with 43 additions and 0 deletions.
  1. +25 −0 lib/app/public/integrity.css
  2. +10 −0 lib/integrity/build.rb
  3. +8 −0 lib/integrity/notifier/email.rb
View
25 lib/app/public/integrity.css
@@ -214,6 +214,8 @@ a {
color: #337022; }
#content #projects li a.failed {
color: #ff1100; }
+ #content #projects li a.fixed {
+ color: #ddff88; }
#content #projects li a.building {
color: #777777; }
#content #projects li .meta {
@@ -241,6 +243,17 @@ a {
color: #77b466; }
#content #projects li.success a:hover, #content #previous_builds li.success a:hover {
background-color: #ddffcc; }
+
+ #content #projects li.fixed a, #content #previous_builds li.fixed a {
+ background-color: #bbf855;
+ border-color: #99d644;
+ color: #337011; }
+ #content #projects li.fixed a .attribution, #content #previous_builds li.fixed a .attribution {
+ color: #77b433; }
+ #content #projects li.fixed a:hover, #content #previous_builds li.fixed a:hover {
+ background-color: #ddff99; }
+
+
#content #projects li.failed a, #content #previous_builds li.failed a {
background-color: #ffbbaa;
border-color: #dd9988;
@@ -279,6 +292,18 @@ a {
#content #build.success .meta a:hover, #content #build.success .github a a:hover, #content #last_build.success .meta a:hover, #content #last_build.success .github a a:hover {
color: #bbf8aa;
background-color: #337022; }
+
+ #content #build.fixed h1, #content #build.fixed blockquote, #content #last_build.fixed h1, #content #last_build.fixed blockquote {
+ background-color: #bbf855;
+ border-color: #99d644 #ccff60 #ccff60 #99d644; }
+ #content #build.fixed h1, #content #last_build.fixed h1 {
+ color: #337011; }
+ #content #build.fixed .meta, #content #build.success .github a, #content #last_build.fixed .meta, #content #last_build.success .fixed a {
+ color: #77b433; }
+ #content #build.fixed .meta a:hover, #content #build.fixed .github a a:hover, #content #last_build.fixed .meta a:hover, #content #last_build.fixed .github a a:hover {
+ color: #bbf855;
+ background-color: #337011; }
+
#content #build.failed h1, #content #build.failed blockquote, #content #last_build.failed h1, #content #last_build.failed blockquote {
background-color: #ffbbaa;
border-color: #dd9988 #ffccbb #ffccbb #dd9988; }
View
10 lib/integrity/build.rb
@@ -4,6 +4,7 @@ class Build
HUMAN_STATUS = {
:success => "Built %s successfully",
+ :fixed => "%s has been fixed",
:failed => "Built %s and failed",
:pending => "%s hasn't been built yet",
:building => "%s is building"
@@ -34,6 +35,10 @@ class Build
end
end
+ def previous_build
+ @previous_build ||= Build.first(:order => [:id.desc], :id.lt => id, :project_id => project_id)
+ end
+
def run
Integrity.config.builder.enqueue(self)
end
@@ -46,6 +51,10 @@ def notify
project.enabled_notifiers.each { |n| n.notify(self) }
end
+ def fixed?
+ successful? && previous_build && previous_build.failed?
+ end
+
def successful?
successful == true
end
@@ -132,6 +141,7 @@ def status
case
when building? then :building
when pending? then :pending
+ when fixed? then :fixed
when successful? then :success
when failed? then :failed
end
View
8 lib/integrity/notifier/email.rb
@@ -10,6 +10,14 @@ class Notifier
class Email < Notifier::Base
attr_reader :to, :from
+ def self.notify(build, config)
+ if build.success? && build.previous_build
+ Integrity.logger.info("Skiped notifying of build #{build.sha1_short} with #{to_s}")
+ else
+ super
+ end
+ end
+
def self.to_haml
@haml ||= File.read(File.dirname(__FILE__) + "/email.haml")
end

0 comments on commit 57ffa27

Please sign in to comment.