Sha256: 5035ffcec8aa60eddfa79ffd12f22e01aae70fe60ff35f8b5efa34bd3675ed46

Contents?: true

Size: 978 Bytes

Versions: 3

Compression:

Stored size: 978 Bytes

Contents

# libnotify plugin for autotest

begin require 'rubygems'; rescue LoadError; end
require 'libnotify'

module Autotest::LibNotify

  LibNotify.init("autotest")

  def self.notify title, msg, ico = :info
    LibNotify::Notification.new(title, msg, "gtk-#{ico}", nil).show
  end

  Autotest.add_hook :red do |at|
    failed_tests = at.files_to_test.inject(0){ |s,a| k,v = a;  s + v.size}
    notify "Tests Failed", "#{failed_tests} tests failed", :no
  end

  Autotest.add_hook :green do |at|
    notify "Tests Passed", "All tests passed", :yes
  end

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

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

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

  Autotest.add_hook :all do |at|_hook
    notify "autotest", "Tests have fully passed", :yes unless $TESTING
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ZenTest-3.5.1 lib/autotest/notify.rb
ZenTest-3.5.2 lib/autotest/notify.rb
ZenTest-3.6.0 lib/autotest/notify.rb