Guest User

Untitled

a guest
Apr 26th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. require 'autotest/redgreen'
  2.  
  3. module Autotest::Growl
  4. def self.growl title, msg, img, pri=0, stick=""
  5. system "growlnotify -H localhost -n autotest --image #{img} -p #{pri} -m #{ msg.inspect} #{title} #{stick}"
  6. end
  7.  
  8. Autotest.add_hook :ran_command do |autotest|
  9. filtered = autotest.results.grep(/\d+\s.*examples?/)
  10. output = filtered.empty? ? "" : filtered.last.slice(/(\d+)\s.*examples?,\s(\d+)\s.*failures?(?:,\s(\d+)\s.*pending)?/)
  11. if output =~ /[1-9]\sfailures?/
  12. growl "Test Results", "#{output}", "~/.autotest_images/rails_fail.png"
  13. elsif output =~ /pending/
  14. growl "Test Results", "#{output}", "~/.autotest_images/rails_pending.png"
  15. else
  16. growl "Test Results", "#{output}", "~/.autotest_images/rails_ok.png"
  17. end
  18. end
  19.  
  20. end
  21.  
  22. Autotest.add_hook :initialize do |at|
  23. %w{.svn .hg .git vendor}.each {|exception| at.add_exception(exception)}
  24. end
Add Comment
Please, Sign In to add comment