Sha256: de14dd709e9c2d07613426fe7ac45f55311abc887afff1cd2f0dbad160791ef6
Contents?: true
Size: 774 Bytes
Versions: 2
Compression:
Stored size: 774 Bytes
Contents
require 'launchdr' require 'fileutils' module MultiScheduler class Launchd < Scheduler def start stop plist.dump USER_AGENT plist.load! end def stop return false unless plist_exists? plist.unload! FileUtils.rm_f plist.file end private USER_AGENT = LaunchDr::Launchd::Paths[:user_agent] def plist_exists? begin File.exists? plist.file rescue false end end def plist @plist ||= LaunchDr::Launchd.new(@identifier).tap do |plist| plist[:ProgramArguments] = @command_arguments.dup.unshift(@command) plist[:RunAtLoad] = true plist[:EnvironmentVariables] = { 'PATH' => ENV['PATH'] } # TODO: add path option end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
multi_scheduler-0.1.1 | lib/multi_scheduler/launchd.rb |
multi_scheduler-0.1.0 | lib/multi_scheduler/launchd.rb |