Sha256: f13b6236643febddf718e93b8ce3dbab752fa4587f5489de47777b7f6f94d3f3
Contents?: true
Size: 794 Bytes
Versions: 4
Compression:
Stored size: 794 Bytes
Contents
module Notifier module GNTP extend self def supported? Timeout.timeout(1) { TCPSocket.new(host, port).close } true rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH, Timeout::Error false end def port ENV.fetch("GNTP_PORT", 23053) end def host ENV["GNTP_HOST"] || ssh_connection || "127.0.0.1" end def ssh_connection ENV["SSH_CONNECTION"][/^([^ ]+)/, 1] if ENV["SSH_CONNECTION"] end def notify(options) gntp = Adapters::GNTP.new({ :name => "test_notifier", :host => host, :port => port }) gntp.notify({ :name => "status", :title => options[:title], :message => options[:message], :icon => options[:image] }) end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
notifier-0.5.1 | lib/notifier/gntp.rb |
notifier-0.5.0 | lib/notifier/gntp.rb |
notifier-0.4.1 | lib/notifier/gntp.rb |
notifier-0.4.0 | lib/notifier/gntp.rb |