daily pastebin goal
0%
SHARE
TWEET

Untitled

a guest May 24th, 2018 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # -*- ruby -*-
  2.  
  3. # require 'autotest/autoupdate'
  4. # require 'autotest/once'
  5. # require 'autotest/rcov'
  6. # require 'autotest/restart'
  7. # require 'autotest/timestamp'
  8.  
  9. # Autotest::AutoUpdate.sleep_time = o
  10. # Autotest::AutoUpdate.update_cmd = o
  11. # Autotest::RCov.command = o
  12. # Autotest::RCov.pattern = o
  13.  
  14. module Autotest::Growl
  15.         def self.growl title, msg, img="~/images/rails_ok.png", pri=0, sticky=""
  16.                 msg += " at #{Time.now.strftime('%Y-%m-%d %H:%M:%S')}"
  17.           system "growlnotify -n autotest --image #{img} -p #{pri} -m #{msg.inspect} #{title} #{sticky}"
  18.         end
  19.  
  20.         Autotest.add_hook :ran_command do |at|
  21.                 results = [at.results].flatten.join("¥n")
  22.                 output = results.slice(/\d+\s+examples,\s*(\d)\s*failure/)
  23.                 if output
  24.                         if $~[1].to_i > 0
  25.                                 growl "Tests Failed", "#{output}", "~/images/rails_fail.png", 2
  26.                         else
  27.                                 growl "Tests Passed", "#{output}", "~/images/rails_ok.png", 2
  28.                         end
  29.                 else
  30.                         growl "Tests Errored", "errors", "~/images/rails_fail.png", 2
  31.                 end
  32.         end
  33. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top