Sha256: 46b783c8502050eb64926d6da8280de05e76de1c7ee861681038e303f1a8e923

Contents?: true

Size: 841 Bytes

Versions: 1

Compression:

Stored size: 841 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 -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

1 entries across 1 versions & 1 rubygems

Version Path
ZenTest-3.11.1 lib/autotest/growl.rb