class Guard::Notifier::GNTP
notification :gntp, sticky: true, host: ‘192.168.1.5’, password: ‘secret’
@example Add the ‘:gntp` notifier with configuration options to your `Guardfile`
notification :gntp
@example Add the `:gntp` notifier to your `Guardfile`
end
gem ’ruby_gntp’
group :development
@example Add the ‘ruby_gntp` gem to your `Gemfile`
* [Snarl](sites.google.com/site/snarlapp)
* [Growl for Linux](mattn.github.com/growl-for-linux)
* [Growl for Windows](www.growlforwindows.com)
* [Growl](growl.info)
[Growl Network Transport Protocol](www.growlforwindows.com/gfw/help/gntp.aspx):
notifications to the following system notification frameworks through the
This gem is available for OS X, Linux and Windows and sends system<br><br>(github.com/snaka/ruby_gntp) gem.
System notifications using the
def self.available?(opts = {})
def self.available?(opts = {}) super and require_gem_safely(opts) end
def self.gem_name
def self.gem_name 'ruby_gntp' end
def self.supported_hosts
def self.supported_hosts %w[darwin linux freebsd openbsd sunos solaris mswin mingw cygwin] end
def _client(opts = {})
def _client(opts = {}) @_client ||= begin gntp = ::GNTP.new('Guard', opts.delete(:host) { CLIENT_DEFAULTS[:host] }, opts.delete(:password) { CLIENT_DEFAULTS[:password] }, opts.delete(:port) { CLIENT_DEFAULTS[:port] }) _register!(gntp) gntp end end
def _register!(gntp_client)
def _register!(gntp_client) gntp_client.register( app_icon: images_path.join('guard.png').to_s, notifications: [ { name: 'notify', enabled: true }, { name: 'failed', enabled: true }, { name: 'pending', enabled: true }, { name: 'success', enabled: true } ] ) end
def notify(message, opts = {})
(**opts)
-
sticky
(Boolean
) -- make the notification sticky -
port
(Integer
) -- the port to send a remote notification -
password
(String
) -- the password used for remote -
host
(String
) -- the hostname or IP address to which to send -
image
(String
) -- the path to the notification image -
title
(String
) -- the notification title -
type
(String
) -- the notification type. Either 'success',
Parameters:
-
opts
(Hash
) -- additional notification library options -
message
(String
) -- the notification message body
def notify(message, opts = {}) super self.class.require_gem_safely opts = DEFAULTS.merge( name: opts.delete(:type).to_s, text: message, icon: opts.delete(:image) ).merge(opts) _client(opts).notify(opts) end