Sha256: 4db6785fd9ddb9652e1c00f1807f67adfc91cd49b013d0a92bcf1d5ee16c0844

Contents?: true

Size: 1.33 KB

Versions: 23

Compression:

Stored size: 1.33 KB

Contents

# special thanks to: Patrick Hurley <phurley@gmail.com>
# requires the ruby-snarl gem.

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

module Autotest::Snarl  
  def self.icon
    # icons from http://www.famfamfam.com/lab/icons/silk/
    path = File.join(File.dirname(__FILE__), "/../icons")
    {
      :green => "#{path}/accept.png",
      :red    => "#{path}/exclamation.png",
      :info   => "#{path}/information.png"
    }
  end
  
  def self.snarl title, msg, ico = nil
    Snarl.show_message(title, msg, icon[ico])
  end

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

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

  Autotest.add_hook :green do |at|
    snarl "Tests Passed", "All tests passed", :green #if at.tainted 
  end

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

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

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

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

end

Version data entries

23 entries across 23 versions & 3 rubygems

Version Path
grosser-autotest-4.0.3 lib/autotest/snarl.rb
grosser-autotest-4.0.4 lib/autotest/snarl.rb
ryanbriones-ZenTest-3.11.1 lib/autotest/snarl.rb
ZenTest-3.4.0 lib/autotest/snarl.rb
ZenTest-3.4.1 lib/autotest/snarl.rb
ZenTest-3.4.2 lib/autotest/snarl.rb
ZenTest-3.4.3 lib/autotest/snarl.rb
ZenTest-3.5.1 lib/autotest/snarl.rb
ZenTest-3.5.2 lib/autotest/snarl.rb
ZenTest-3.6.0 lib/autotest/snarl.rb
ZenTest-3.6.1 lib/autotest/snarl.rb
ZenTest-3.7.0 lib/autotest/snarl.rb
ZenTest-3.7.1 lib/autotest/snarl.rb
ZenTest-3.7.2 lib/autotest/snarl.rb
ZenTest-3.8.0 lib/autotest/snarl.rb
ZenTest-3.9.0 lib/autotest/snarl.rb
ZenTest-3.9.1 lib/autotest/snarl.rb
ZenTest-3.9.2 lib/autotest/snarl.rb
ZenTest-3.9.3 lib/autotest/snarl.rb
ZenTest-3.10.0 lib/autotest/snarl.rb