nofxx /.autotest

ZenTest - autotest
# #
# nofxx  - 2008
#
# http://wiki.nofxx.com/rspec
#
# FAIL IMAGE => http://wiki.nofxx.com/_media/fail.png
# PASS IMAGE => http://wiki.nofxx.com/_media/pass.png
#require 'autotest/growl'
require 'autotest/html_report'
# require 'autotest/kdenotify'
require 'autotest/menu'
#require 'autotest/pretty'
require 'autotest/redgreen'
# require 'autotest/snarl'
require 'autotest/timestamp'


module Autotest::Growl
  def self.growl pass, title, msg, img, pri=0, sticky=""
    system "growlnotify -n #{pass} --image #{img} -p #{pri} -m #{msg.inspect} #{title} #{sticky}"
  end
  
  Autotest.add_hook :initialize do |at|
    growl "autotest", "Rodando..", "Started autotest", ''
  end

  Autotest.add_hook :ran_command do |at|
    output = at.results.last.gsub!(/(\e\[3\dm)|(\e\[0m)|(\n)/, '') unless at.results.last.nil?
    if output =~ /[1-9]\sfailures?/
      growl "epic", "BURRO!", "#{output}", ".autotest_images/fail.png", 2, "-s"
    else
      growl "autotest", "GO GO GO", "#{output}", ".autotest_images/pass.png",2
    end
  end

end