Sha256: b2b7bbfe9b46bc26eeb85e06fb66a8fb835dc2e0adad7fd05ee853f96d11a71c
Contents?: true
Size: 930 Bytes
Versions: 1
Compression:
Stored size: 930 Bytes
Contents
module LaunchAgent module CLI class OptionParser def initialize(opts, argv) @opts = opts @argv = argv end def agent raise 'full command must be supplied' if @argv.empty? daemon = @opts[:daemon] interval = @opts[:interval] env = (@opts[:env] || '').split(',') wdir = @opts[:wdir] agent = nil if daemon agent = LaunchAgent::Daemon.new(*@argv) elsif interval agent = LaunchAgent::Periodic.new(interval.to_i, *@argv) else raise 'at least one of --daemon and --interval must be set' end agent['EnvironmentVariables'] = env.inject({}) do |memo, e| k, v = e.split('=') memo[k] = v memo end if wdir agent['WorkingDirectory'] = File.expand_path(wdir) end agent end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
launch-agent-0.6.1 | lib/launch_agent/cli.rb |