Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 03c4abbd5b
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 60 lines (56 sloc) 1.992 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
# require 'autotest/autoupdate'
# require 'autotest/camping'
# require 'autotest/cctray'
# require 'autotest/emacs'
# require 'autotest/email_notify'
# require 'autotest/fixtures'
# require 'autotest/growl'
# require 'autotest/heckle'
# require 'autotest/html_report'
# require 'autotest/jabber_notify'
# require 'autotest/kdenotify'
# require 'autotest/menu'
# require 'autotest/migrate'
# require 'autotest/notify'
# require 'autotest/pretty'
# require 'autotest/rcov'
# require 'autotest/redgreen'
# require 'autotest/screen'
# require 'autotest/shame'
# require 'autotest/snarl'
require 'autotest/timestamp'

# Autotest::AutoUpdate.sleep_time = o
# Autotest::AutoUpdate.update_cmd = o
# Autotest::CCTray.project_name = name
# Autotest::Emacs.command = o
# Autotest::EmailNotify.smtp_settings = o
# Autotest::EmailNotify.from = o
# Autotest::EmailNotify.recipients = o
# Autotest::EmailNotify.use_svn = o
# Autotest::EmailNotify.report_every_run = o
# Autotest::Growl.growl title, msg, pri = 0
# Autotest::JabberNotify.recipients = o
# Autotest::JabberNotify.account = o
# Autotest::JabberNotify.password = o
# Autotest::JabberNotify.use_svn = o
# Autotest::JabberNotify.report_every_run = o
# Autotest::RCov.pattern = o
# Autotest::Shame.chat_app = o
# Autotest::Snarl.snarl title, msg, ico = nil

module Autotest::Notify
  def self.notify(title, msg, img, pri='low', time=3000)
    `notify-send -i #{img} -u #{pri} -t #{time} '#{title}' '#{msg}'`
  end

  Autotest.add_hook :ran_command do |autotest|
    results = [autotest.results].flatten.join("\n")
    output = results.slice(/(\d+)\s+examples?,\s*(\d+)\s+failures?(,\s*(\d+)\s+pending)?/)
    folder = "~/.autotest.d/images/"
    if output =~ /[1-9]\d*\sfailures?/
      notify "FAIL:", "#{output}", "dialog-error", 'critical', 10000
    elsif output =~ /[1-9]\d*\spending?/
      notify "PENDING:", "#{output}", "dialog-warning", 'normal', 10000
    else
      notify "PASS:", "#{output}", "dialog-information"
    end
  end
end
Something went wrong with that request. Please try again.