Sha256: d74d4ba7d6ff947c0249617d9df759d3ddbe6b572aa5bd3057e42a14e636f3cf

Contents?: true

Size: 833 Bytes

Versions: 4

Compression:

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

4 entries across 4 versions & 2 rubygems

Version Path
ryanbriones-ZenTest-3.11.1 lib/autotest/growl.rb
ZenTest-3.9.3 lib/autotest/growl.rb
ZenTest-3.10.0 lib/autotest/growl.rb
ZenTest-3.11.0 lib/autotest/growl.rb