Class: AgentsControl::Service::Launchd

Inherits:
Service
  • Object
show all
Defined in:
lib/agents_control/service.rb

Overview

macOS.

Instance Method Summary collapse

Instance Method Details

#install ⇒ Object



53
54
55
56
57
# File 'lib/agents_control/service.rb', line 53

def install
  write(path, plist)
  reload
  path
end

#installed? ⇒ Boolean

Returns:



64
# File 'lib/agents_control/service.rb', line 64

def installed? = File.exist?(path)

#path ⇒ Object



51
# File 'lib/agents_control/service.rb', line 51

def path = File.expand_path("~/Library/LaunchAgents/#{LABEL}.plist")

#uninstall ⇒ Object



59
60
61
62
# File 'lib/agents_control/service.rb', line 59

def uninstall
  system("launchctl", "unload", path, out: File::NULL, err: File::NULL) if File.exist?(path)
  FileUtils.rm_f(path)
end