Guest User

Untitled

a guest
May 27th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. module KNotify
  2. def self.notify(title, msg, colour)
  3. system 'dcop knotify default notify eventname ' +
  4. "'<span style=\"font-weight: bold; color: #{colour}\">#{title}</span>' " +
  5. "'<span style=\"color: #{colour}\">#{msg}</span>' '' '' 16 2"
  6. end
  7.  
  8. Autotest.add_hook(:initialize) do |autotest|
  9. %w{ .svn .hg .git vendor }.each { |exception| autotest.add_exception(exception) }
  10. end
  11.  
  12. Autotest.add_hook(:ran_command) do |autotest|
  13. if autotest.results.split("\n").last.first =~ /([0-9]+\sexamples,\s([0-9]+)\sfailures?(,\s([0-9]+) pending)?)/
  14. notify(*case
  15. when $2.to_i > 0: ['FAILED', $1, 'darkred']
  16. when $4.to_i > 0: ['PASSED', $1, 'goldenrod']
  17. else ['PASSED', $1, 'darkgreen']
  18. end)
  19. end
  20. end
  21. end
Add Comment
Please, Sign In to add comment