Created
August 1, 2012 02:01
-
-
Save jugyo/3222737 to your computer and use it in GitHub Desktop.
earthquake plugin to notify via Notification Center on Mountain Lion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
begin | |
require 'terminal-notifier' | |
module Earthquake | |
module Core | |
def notify_with_nc(message, options = {}) | |
if matches = URI.extract(message, ["http", "https"]) | |
options[:open] = matches[0] | |
end | |
notify_without_nc(message, options) | |
end | |
alias_method :notify_without_nc, :notify | |
alias_method :notify, :notify_with_nc | |
alias_method :n, :notify | |
end | |
end | |
rescue LoadError => e | |
puts 'You need terminal-notifier.gem' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment