Sha256: 89cd65ff686d94f365f7f1e3f11c48bc2ca22cea5b4d514647ad7f4136361160

Contents?: true

Size: 844 Bytes

Versions: 3

Compression:

Stored size: 844 Bytes

Contents

# -*- ruby -*-

module Autotest::Growl
  def self.growl title, msg, pri = 0, img = nil
    title += " in #{Dir.pwd.split(/\//).last(3).join("/")}"
    msg += " at #{Time.now.strftime('%Y-%m-%d %H:%M:%S')}"
    # TODO: parameterize default image
    img ||= "/Applications/Mail.app/Contents/Resources/Caution.tiff"
    cmd = "growlnotify -w -n autotest --image #{img} -p #{pri} -m #{msg.inspect} #{title}"
    system cmd
    nil
  end

  Autotest.add_hook :initialize do  |at|
    growl "autotest running", "Started"
  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", "Tests passed", -2 if at.tainted
  end

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

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
grosser-autotest-4.0.3 lib/autotest/growl.rb
grosser-autotest-4.0.4 lib/autotest/growl.rb
ZenTest-4.0.0 lib/autotest/growl.rb