Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
# ~/.autotest module Autotest::GnomeNotify EXPIRATION_IN_SECONDS = 3 # FAIL_IMAGE = "gtk-dialog-error" # PENDING_IMAGE = "gtk-dialog-warning" # SUCCESS_IMAGE = "gtk-dialog-info" FAIL_IMAGE = "~/Imagens/rails_fail.png" PENDING_IMAGE = "~/Imagens/rails_pending.png" SUCCESS_IMAGE = "~/Imagens/rails_success.png" def self.notify title, message, stock_icon options = "-t #{EXPIRATION_IN_SECONDS * 1000} -i #{stock_icon}" system "notify-send #{options} '#{title}' '#{message}'" end Autotest.add_hook :ran_command do |at| result = at.results.last if result tests = result =~ /(\d+) tests/ ? $1.to_i : 0 assertions = result =~ /(\d+) assertions/ ? $1.to_i : 0 failures = result =~ /(\d+) failures/ ? $1.to_i : 0 errors = result =~ /(\d+) errors/ ? $1.to_i : 0 examples = result =~ /(\d+) examples/ ? $1.to_i : 0 pendings = result =~ /(\d+) pending/ ? $1.to_i : 0 if failures > 0 or errors > 0 notify "Tests Failed", "#{tests} tests\n#{assertions} assertions\n#{failures} failures\n#{errors} errors", FAIL_IMAGE elsif pendings > 0 notify "Tests Pending", "#{tests} tests\n#{assertions} assertions\n#{failures} failures\n#{errors} errors\n#{pendings} pendings\n", PENDING_IMAGE else notify "Tests Passed", "#{tests} tests\n#{assertions} assertions\n#{failures} failures\n#{errors} errors", SUCCESS_IMAGE end end end end
This paste will be private.
From the Design Piracy series on my blog: