module Guard::Notifier::GrowlNotify
def available?(silent = false)
-
(Boolean)
- the availability status
Parameters:
-
silent
(Boolean
) -- true if no error messages should be shown
def available?(silent = false) if RbConfig::CONFIG['host_os'] =~ /darwin/ require 'growl_notify' begin if ::GrowlNotify.application_name != 'Guard' ::GrowlNotify.config do |c| c.notifications = ['success', 'pending', 'failed', 'notify'] c.default_notifications = 'notify' c.application_name = 'Guard' end end true rescue ::GrowlNotify::GrowlNotFound ::Guard::UI.error 'Please install Growl from http://growl.info' unless silent false end else ::Guard::UI.error 'The :growl_notify notifier runs only on Mac OS X.' unless silent false end rescue LoadError ::Guard::UI.error "Please add \"gem 'growl_notify'\" to your Gemfile and run Guard with \"bundle exec\"." unless silent false end
def notify(type, title, message, image, options = { })
(**options)
-
priority
(Integer
) -- the importance of message from -2 (very low) to 2 (emergency) -
sticky
(Boolean
) -- if the message should stick to the screen
Parameters:
-
options
(Hash
) -- additional notification library options -
image
(String
) -- the path to the notification image -
message
(String
) -- the notification message body -
title
(String
) -- the notification title -
type
(String
) -- the notification type. Either 'success', 'pending', 'failed' or 'notify'
def notify(type, title, message, image, options = { }) require 'growl_notify' ::GrowlNotify.send_notification(DEFAULTS.merge(options).merge({ :application_name => 'Guard', :with_name => type, :title => title, :description => message, :icon => image })) end