launch-agent 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/launchagent +39 -0
- data/lib/launch_agent/version.rb +1 -1
- metadata +10 -14
- data/bin/launchagent-daemon +0 -32
- data/bin/launchagent-periodic +0 -33
data/bin/launchagent
CHANGED
@@ -5,4 +5,43 @@ require 'git-style-binary/command'
|
|
5
5
|
|
6
6
|
GitStyleBinary.primary do
|
7
7
|
version "launch-agent #{LaunchAgent::VERSION}"
|
8
|
+
|
9
|
+
short_desc "load/unload a launchd agent"
|
10
|
+
banner <<-EOS
|
11
|
+
Usage: #{command.full_name} #{all_options_string} {full command}
|
12
|
+
|
13
|
+
Load/Unload a launchd agent
|
14
|
+
|
15
|
+
EOS
|
16
|
+
opt :env, "additional environmental variables to be set before running the job. can specify multiple times. e.g. RAILS_ENV=development", :type => String, :multi => true
|
17
|
+
opt :daemon, "load as daemon. if it is set, --interval option is ignored", :default => false
|
18
|
+
opt :interval, "causes the job to be started every N seconds", :type => Integer
|
19
|
+
|
20
|
+
run do |command|
|
21
|
+
abort 'full command must be supplised' if command.argv.empty?
|
22
|
+
|
23
|
+
daemon = command.opts[:daemon]
|
24
|
+
integer = command.opts[:interval]
|
25
|
+
env = command.opts[:env]
|
26
|
+
agent = nil
|
27
|
+
|
28
|
+
if daemon
|
29
|
+
agent = LaunchAgent::Daemon.new(*command.argv)
|
30
|
+
elsif command.opts.interval
|
31
|
+
agent = LaunchAgent::Daemon.new(interval, *command.argv)
|
32
|
+
else
|
33
|
+
abort 'at least one of --daemon and --interval must be set'
|
34
|
+
end
|
35
|
+
|
36
|
+
agent['EnvironmentVariables'] = env.inject({}) do |memo, e|
|
37
|
+
k, v = e.split('=')
|
38
|
+
memo[k] = v
|
39
|
+
memo
|
40
|
+
end
|
41
|
+
|
42
|
+
action = agent.loaded? ? :unload : :load
|
43
|
+
agent.send(action)
|
44
|
+
|
45
|
+
puts '%s "%s"' % [action, command.argv.join(' ')]
|
46
|
+
end
|
8
47
|
end
|
data/lib/launch_agent/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: launch-agent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-04-
|
12
|
+
date: 2012-04-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: plist
|
16
|
-
requirement: &
|
16
|
+
requirement: &70147772789880 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70147772789880
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: git-style-binaries
|
27
|
-
requirement: &
|
27
|
+
requirement: &70147772789460 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70147772789460
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &70147772788940 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,14 +43,12 @@ dependencies:
|
|
43
43
|
version: 2.8.0
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70147772788940
|
47
47
|
description: A library to use launchd easily
|
48
48
|
email:
|
49
49
|
- youpy@buycheapviagraonlinenow.com
|
50
50
|
executables:
|
51
51
|
- launchagent
|
52
|
-
- launchagent-daemon
|
53
|
-
- launchagent-periodic
|
54
52
|
extensions: []
|
55
53
|
extra_rdoc_files: []
|
56
54
|
files:
|
@@ -61,8 +59,6 @@ files:
|
|
61
59
|
- README.rdoc
|
62
60
|
- Rakefile
|
63
61
|
- bin/launchagent
|
64
|
-
- bin/launchagent-daemon
|
65
|
-
- bin/launchagent-periodic
|
66
62
|
- launch-agent.gemspec
|
67
63
|
- lib/launch_agent.rb
|
68
64
|
- lib/launch_agent/base.rb
|
@@ -86,7 +82,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
86
82
|
version: '0'
|
87
83
|
segments:
|
88
84
|
- 0
|
89
|
-
hash:
|
85
|
+
hash: 2567261959345071323
|
90
86
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
87
|
none: false
|
92
88
|
requirements:
|
@@ -95,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
91
|
version: '0'
|
96
92
|
segments:
|
97
93
|
- 0
|
98
|
-
hash:
|
94
|
+
hash: 2567261959345071323
|
99
95
|
requirements: []
|
100
96
|
rubyforge_project:
|
101
97
|
rubygems_version: 1.8.10
|
data/bin/launchagent-daemon
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'git-style-binary/command'
|
4
|
-
|
5
|
-
GitStyleBinary.command do
|
6
|
-
short_desc "load/unload a daemon-like agent"
|
7
|
-
banner <<-EOS
|
8
|
-
Usage: #{command.full_name} #{all_options_string} {full command}
|
9
|
-
|
10
|
-
Load/Unload a daemon-like launchd agent
|
11
|
-
|
12
|
-
|
13
|
-
EOS
|
14
|
-
opt :env, "additional environmental variables to be set before running the job. can specify multiple times", :type => String, :multi => true
|
15
|
-
|
16
|
-
run do |command|
|
17
|
-
abort 'full command must be supplised' if command.argv.empty?
|
18
|
-
|
19
|
-
agent = LaunchAgent::Daemon.new(*command.argv)
|
20
|
-
|
21
|
-
agent['EnvironmentVariables'] = command.opts[:env].inject({}) do |memo, env|
|
22
|
-
k, v = env.split('=')
|
23
|
-
memo[k] = v
|
24
|
-
memo
|
25
|
-
end
|
26
|
-
|
27
|
-
action = agent.loaded? ? :unload : :load
|
28
|
-
agent.send(action)
|
29
|
-
|
30
|
-
puts '%s "%s"' % [action, command.argv.join(' ')]
|
31
|
-
end
|
32
|
-
end
|
data/bin/launchagent-periodic
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'git-style-binary/command'
|
4
|
-
|
5
|
-
GitStyleBinary.command do
|
6
|
-
short_desc "load/unload a periodic agent"
|
7
|
-
banner <<-EOS
|
8
|
-
Usage: #{command.full_name} #{all_options_string} {full command}
|
9
|
-
|
10
|
-
Load/Unload a periodic launchd agent
|
11
|
-
|
12
|
-
|
13
|
-
EOS
|
14
|
-
opt :interval, "causes the job to be started every N seconds", :required => true, :type => Integer
|
15
|
-
opt :env, "additional environmental variables to be set before running the job. can specify multiple times", :type => String, :multi => true
|
16
|
-
|
17
|
-
run do |command|
|
18
|
-
abort 'full command must be supplised' if command.argv.empty?
|
19
|
-
|
20
|
-
agent = LaunchAgent::Periodic.new(command.opts[:interval], *command.argv)
|
21
|
-
|
22
|
-
agent['EnvironmentVariables'] = command.opts[:env].inject({}) do |memo, env|
|
23
|
-
k, v = env.split('=')
|
24
|
-
memo[k] = v
|
25
|
-
memo
|
26
|
-
end
|
27
|
-
|
28
|
-
action = agent.loaded? ? :unload : :load
|
29
|
-
agent.send(action)
|
30
|
-
|
31
|
-
puts '%s "%s"' % [action, command.argv.join(' ')]
|
32
|
-
end
|
33
|
-
end
|