class Guard::Notifier::TerminalNotifier
notification :terminal_notifier, app_name: “MyApp”
@example Add the ‘:terminal_notifier` notifier with configuration options to your `Guardfile`
notification :terminal_notifier
@example Add the `:terminal_notifier` notifier to your `Guardfile`
end
gem ’terminal-notifier-guard’
group :development
@example Add the ‘terminal-notifier-guard` gem to your `Gemfile`
to the OS X notification center.
This gem is available for OS X 10.8 Mountain Lion and sends notifications<br><br>gem.<br>(github.com/Springest/terminal-notifier-guard)
System notifications using the
def self._register!(opts)
-
(Boolean)
- whether or not the terminal-notifier-guard gem is available
Other tags:
- Private: -
def self._register!(opts) if ::TerminalNotifier::Guard.available? true else unless opts[:silent] ::Guard::UI.error 'The :terminal_notifier only runs on Mac OS X 10.8 and later.' end false end end
def self.available?(opts = {})
def self.available?(opts = {}) super and require_gem_safely(opts) and _register!(opts) end
def self.gem_name
def self.gem_name 'terminal-notifier-guard' end
def self.supported_hosts
def self.supported_hosts %w[darwin] end
def notify(message, opts = {})
(**opts)
-
open
(String
) -- some url or file -
activate
(String
) -- an app bundle -
execute
(String
) -- a command -
app_name
(String
) -- name of your app -
image
(String
) -- the path to the notification image (ignored) -
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 = {}) title = opts[:title] || options[:title] super self.class.require_gem_safely opts.delete(:image) opts[:title] = title || [opts.delete(:app_name) { 'Guard' }, opts[:type].downcase.capitalize].join(' ') ::TerminalNotifier::Guard.execute(false, opts.merge(message: message)) end