Skip to content
This repository
Fetching contributors…

Cannot retrieve contributors at this time

file 40 lines (31 sloc) 1.017 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
# -*- ruby -*-

require 'autotest/growl'
require 'autotest/fsevent'
require 'autotest/bundler'

module AutoGrowl
  def self.growl title, msg, pri=0
    system "growlnotify -n autotest --image /Applications/Mail.app/Contents/Resources/Caution.tiff -p #{pri} -m #{msg.inspect} #{title}"
  end

  Autotest.add_hook :run do |at|
    growl "Run", "Run" unless $TESTING
  end

  Autotest.add_hook :red do |at|
    growl "Tests Failed", "#{at.files_to_test.size} tests failed", 2
  end

  Autotest.add_hook :green do |at|
    growl "Tests Passed", "All tests passed", -2 if at.tainted
  end

  Autotest.add_hook :init do |at|
    growl "autotest", "autotest was started" unless $TESTING
  end

  Autotest.add_hook :interrupt do |at|
    growl "autotest", "autotest was reset" unless $TESTING
nil
  end

  Autotest.add_hook :quit do |at|
    growl "autotest", "autotest is exiting" unless $TESTING
  end

  Autotest.add_hook :all do |at|_hook
    growl "autotest", "Tests have fully passed", -2 unless $TESTING
  end
end
Something went wrong with that request. Please try again.