Class: Notifiers::TerminalNotifier
- Inherits:
-
Base
- Object
- Base
- Notifiers::TerminalNotifier
show all
- Defined in:
- lib/notifiers/terminal_notifier.rb
Constant Summary
collapse
- COMMAND =
'terminal-notifier'
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
command?, #image, inherited, #message, #notify, platform?, process?, subclasses, success_process_status?, #title
Class Method Details
.installed? ⇒ Boolean
7
8
9
|
# File 'lib/notifiers/terminal_notifier.rb', line 7
def self.installed?
platform?(/darwin/) and command?(COMMAND)
end
|
Instance Method Details
#execute(command) ⇒ Object
26
27
28
29
|
# File 'lib/notifiers/terminal_notifier.rb', line 26
def execute(command)
@execute = command
self
end
|
#group(id) ⇒ Object
16
17
18
19
|
# File 'lib/notifiers/terminal_notifier.rb', line 16
def group(id)
@group = id
self
end
|
#install_instructions ⇒ Object
43
44
45
|
# File 'lib/notifiers/terminal_notifier.rb', line 43
def install_instructions
'terminal-notifier is not installed. Install with: brew install terminal-notifier'
end
|
#open(url) ⇒ Object
21
22
23
24
|
# File 'lib/notifiers/terminal_notifier.rb', line 21
def open(url)
@open = url
self
end
|
#sound(name) ⇒ Object
11
12
13
14
|
# File 'lib/notifiers/terminal_notifier.rb', line 11
def sound(name)
@sound = name
self
end
|
#to_s ⇒ Object
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/notifiers/terminal_notifier.rb', line 31
def to_s
command = COMMAND.dup
command << " -title '#{@title}'" if @title
command << " -message '#{@message}'" if @message
command << " -contentImage '#{@icon}'" if @icon
command << " -sound '#{@sound}'" if @sound
command << " -group '#{@group}'" if @group
command << " -open '#{@open}'" if @open
command << " -execute '#{@execute}'" if @execute
command
end
|