Sha256: fd4668a90257df7b63c98aabe2799e270debd4f83cebda075ed1247c2284d9b3

Contents?: true

Size: 1.2 KB

Versions: 5

Compression:

Stored size: 1.2 KB

Contents

require 'snarl'

module AutoSnarl  
  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

5 entries across 5 versions & 2 rubygems

Version Path
rdp-ruby-snarl-0.0.9 lib/autosnarl.rb
ruby-snarl-0.0.5 lib/autosnarl.rb
ruby-snarl-0.0.7 lib/autosnarl.rb
ruby-snarl-0.0.8 lib/autosnarl.rb
ruby-snarl-0.0.6 lib/autosnarl.rb