Class: Co2Notify
- Inherits:
-
Thor
show all
- Defined in:
- lib/co2-notify.rb,
lib/co2-notify/version.rb
Defined Under Namespace
Classes: Config, HipchatClient, Notifier, Status
Constant Summary
collapse
- PLIST_NAME =
"arkadiybutermanov.co2-notify".freeze
- VERSION =
"0.5.2"
Instance Method Summary
collapse
Instance Method Details
#autoload(path) ⇒ Object
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/co2-notify.rb', line 32
def autoload(path)
data = {
"KeepAlive" => true,
"Label" => PLIST_NAME,
"ProgramArguments" => [
path,
"go"
],
"RunAtLoad" => true,
"StandardOutPath" => Config.output_path,
"StandardErrorPath" => Config.error_path
}
File.open(plist_path, "w") do |f|
f.write Plist::Emit.dump(data)
end
end
|
#go ⇒ Object
12
13
14
|
# File 'lib/co2-notify.rb', line 12
def go
Notifier.start
end
|
#init ⇒ Object
27
28
29
|
# File 'lib/co2-notify.rb', line 27
def init
Config.set
end
|
#start ⇒ Object
17
18
19
|
# File 'lib/co2-notify.rb', line 17
def start
system "launchctl load #{plist_path}"
end
|
#stop ⇒ Object
22
23
24
|
# File 'lib/co2-notify.rb', line 22
def stop
system "launchctl unload #{plist_path}"
end
|