Guest User

Untitled

a guest
Jan 20th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. #!/bin/ruby
  2. #require 'redgreen'
  3. require 'autotest/timestamp'
  4.  
  5. module Autotest::GnomeNotify
  6. def self.notify title, msg, img
  7. system "notify-send '#{title}' '#{msg}' -i #{img} -t 3000"
  8. end
  9.  
  10. Autotest.add_hook :ran_command do |at|
  11. image_root = "~/.autotest_images"
  12. results = [at.results].flatten.join("\n")
  13. results.gsub!(/\\e\[\d+m/,'')
  14. output = results.slice(/(\d+)\sexamples?,\s(\d+)\sfailures?/)
  15. puts output.inspect
  16. if output
  17. if $~[2].to_i > 0
  18. notify "FAIL", "#{output}", "#{image_root}/fail.png"
  19. else
  20. notify "Pass", "#{output}", "#{image_root}/pass.png"
  21. end
  22. end
  23. end
  24.  
  25. end
Add Comment
Please, Sign In to add comment