launchr 1.1.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.
@@ -0,0 +1,95 @@
1
+ .\" generated with Ronn/v0.7.3
2
+ .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
+ .
4
+ .TH "BREW\-LAUNCHD" "1" "August 2010" "Homebrew" "brew"
5
+ .
6
+ .SH "NAME"
7
+ \fBbrew\-launchd\fR \- Start and stop launchd services
8
+ .
9
+ .SH "SYNOPSIS"
10
+ \fBbrew\fR { start | stop | restart } [\-\-user|\-\-boot] service,(s) \.\.\.
11
+ .
12
+ .br
13
+ \fBbrew launchd\fR default { \-\-user | \-\-boot }
14
+ .
15
+ .br
16
+ \fBbrew launchd\fR info [ service,(s) ] \.\.\.
17
+ .
18
+ .br
19
+ \fBbrew launchd\fR clean
20
+ .
21
+ .br
22
+ \fBbrew launchd\fR { \-\-help | \-\-version }
23
+ .
24
+ .SH "SERVICES"
25
+ .
26
+ .TP
27
+ \fBformula_name\fR
28
+ The brew formula name\. Internally expanded into a list of Launchd job labels\.
29
+ .
30
+ .TP
31
+ \fBcom\.launchd\.job\.label[\.plist]\fR
32
+ The name of the Launchd job label\. Also the plist filename\. Useful when a formula has installed multiple launchd services (sub\-services)\.
33
+ .
34
+ .SH "DESCRIPTION"
35
+ Brew\-launchd is an extension to Homebrew to start and stop Launchd services\.
36
+ .
37
+ .P
38
+ The launchd service status of a brew formula is managed by symlinks\. When a formula is installed, any launchd plists are linked into \fI$HOMEBREW_PREFIX/Library/LaunchDaemons\fR\. Later, when a service is started, those symlinks are redirected to the target LaunchDaemons folder (as per \-\-user / \-\-boot)\. Launchctl is then called to bring the service up/down\.
39
+ .
40
+ .P
41
+ If a running service is deleted or uninstalled, it should be stopped first with \fBbrew stop\fR\. Otherwise the launchd database will be left in a state which is inconsistent with the symlinks in \fI$HOMEBREW_PREFIX/Library/LaunchDaemons\fR\. However the auto clean feature will recover from the majority of such situations\.
42
+ .
43
+ .P
44
+ \fBSudo\fR is absolutely required to install boot\-time services\. The corresponding keg will be \fBchown \-R\'d\fR to \fBroot:wheel\fR\. This is a strict requirement of Apple\'s Launchd\. When the service is stopped, the keg is chown\'ed back to user ownership of the enclosing folder\.
45
+ .
46
+ .SH "OPTIONS"
47
+ .
48
+ .TP
49
+ \fBstart\fR [\-\-user|\-\-boot] service,(s) \.\.\.
50
+ Start launchd services\. Equivalent to launchctl load \-w files\.\.\.
51
+ .
52
+ .TP
53
+ \fBstop\fR [\-\-user|\-\-boot] service,(s) \.\.\.
54
+ Stop launchd services\. Equivalent to launchctl unload \-w files\.\.\.
55
+ .
56
+ .TP
57
+ \fBrestart\fR [\-\-user|\-\-boot] service,(s) \.\.\.
58
+ Restart launchd services\.
59
+ .
60
+ .TP
61
+ \fB\-\-user\fR
62
+ Start at user login\. Otherwise, the default setting will be used\.
63
+ .
64
+ .TP
65
+ \fB\-\-boot\fR
66
+ Start at boot time\. Requires sudo / root privelidges\. Otherwise, the default setting will be used\.
67
+ .
68
+ .TP
69
+ \fBinfo\fR [ service,(s) ] \.\.\.
70
+ Info for launchd services\. With no arguments, print info for all installed services\.
71
+ .
72
+ .TP
73
+ \fBclean\fR
74
+ Clean missing/broken launchd services\.
75
+ .
76
+ .TP
77
+ \fBdefault\fR { \-\-user | \-\-boot }
78
+ Set the default target for launchd services\. Defaults to \-\-user, which will start daemons at user login (ie via Loginwindow, not ssh)\. Whearas \-\-boot will ensure all services are set to start at boot time\. This option can be overriden on a case\-by\-case basis\.
79
+ .
80
+ .TP
81
+ \fB\-\-help\fR
82
+ Show help summary
83
+ .
84
+ .TP
85
+ \fB\-\-version\fR
86
+ Print version information
87
+ .
88
+ .SH "BUGS"
89
+ The upstreams BTS can be found at \fIhttp://github\.com/dreamcat4/brew\-launchd/issues\fR\.
90
+ .
91
+ .SH "SEE ALSO"
92
+ brew(1), launchctl(1), launchd(8), launchd\.plist(5)
93
+ .
94
+ .SH "Author"
95
+ Copyright (C) 2010 Dreamcat4\. See LICENSE for details\.
@@ -0,0 +1,140 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta http-equiv='content-type' value='text/html;charset=utf8'>
5
+ <meta name='generator' value='Ronn/v0.7.3 (http://github.com/rtomayko/ronn/tree/0.7.3)'>
6
+ <title>brew-launchd(1) - Start and stop launchd services</title>
7
+ <style type='text/css' media='all'>
8
+ /* style: man */
9
+ body#manpage {margin:0}
10
+ .mp {max-width:100ex;padding:0 9ex 1ex 4ex}
11
+ .mp p,.mp pre,.mp ul,.mp ol,.mp dl {margin:0 0 20px 0}
12
+ .mp h2 {margin:10px 0 0 0}
13
+ .mp > p,.mp > pre,.mp > ul,.mp > ol,.mp > dl {margin-left:8ex}
14
+ .mp h3 {margin:0 0 0 4ex}
15
+ .mp dt {margin:0;clear:left}
16
+ .mp dt.flush {float:left;width:8ex}
17
+ .mp dd {margin:0 0 0 9ex}
18
+ .mp h1,.mp h2,.mp h3,.mp h4 {clear:left}
19
+ .mp pre {margin-bottom:20px}
20
+ .mp pre+h2,.mp pre+h3 {margin-top:22px}
21
+ .mp h2+pre,.mp h3+pre {margin-top:5px}
22
+ .mp img {display:block;margin:auto}
23
+ .mp h1.man-title {display:none}
24
+ .mp,.mp code,.mp pre,.mp tt,.mp kbd,.mp samp,.mp h3,.mp h4 {font-family:monospace;font-size:14px;line-height:1.42857142857143}
25
+ .mp h2 {font-size:16px;line-height:1.25}
26
+ .mp h1 {font-size:20px;line-height:2}
27
+ .mp {text-align:justify;background:#fff}
28
+ .mp,.mp code,.mp pre,.mp pre code,.mp tt,.mp kbd,.mp samp {color:#131211}
29
+ .mp h1,.mp h2,.mp h3,.mp h4 {color:#030201}
30
+ .mp u {text-decoration:underline}
31
+ .mp code,.mp strong,.mp b {font-weight:bold;color:#131211}
32
+ .mp em,.mp var {font-style:italic;color:#232221;text-decoration:none}
33
+ .mp a,.mp a:link,.mp a:hover,.mp a code,.mp a pre,.mp a tt,.mp a kbd,.mp a samp {color:#0000ff}
34
+ .mp b.man-ref {font-weight:normal;color:#434241}
35
+ .mp pre {padding:0 4ex}
36
+ .mp pre code {font-weight:normal;color:#434241}
37
+ .mp h2+pre,h3+pre {padding-left:0}
38
+ ol.man-decor,ol.man-decor li {margin:3px 0 10px 0;padding:0;float:left;width:33%;list-style-type:none;text-transform:uppercase;color:#999;letter-spacing:1px}
39
+ ol.man-decor {width:100%}
40
+ ol.man-decor li.tl {text-align:left}
41
+ ol.man-decor li.tc {text-align:center;letter-spacing:4px}
42
+ ol.man-decor li.tr {text-align:right;float:right}
43
+ </style>
44
+ </head>
45
+ <!--
46
+ The following styles are deprecated and will be removed at some point:
47
+ div#man, div#man ol.man, div#man ol.head, div#man ol.man.
48
+
49
+ The .man-page, .man-decor, .man-head, .man-foot, .man-title, and
50
+ .man-navigation should be used instead.
51
+ -->
52
+ <body id='manpage'>
53
+ <div class='mp' id='man'>
54
+
55
+ <div class='man-navigation' style='display:none'>
56
+ <a href="#NAME">NAME</a>
57
+ <a href="#SYNOPSIS">SYNOPSIS</a>
58
+ <a href="#SERVICES">SERVICES</a>
59
+ <a href="#DESCRIPTION">DESCRIPTION</a>
60
+ <a href="#OPTIONS">OPTIONS</a>
61
+ <a href="#BUGS">BUGS</a>
62
+ <a href="#SEE-ALSO">SEE ALSO</a>
63
+ <a href="#Author">Author</a>
64
+ </div>
65
+
66
+ <ol class='man-decor man-head man head'>
67
+ <li class='tl'>brew-launchd(1)</li>
68
+ <li class='tc'>brew</li>
69
+ <li class='tr'>brew-launchd(1)</li>
70
+ </ol>
71
+
72
+ <h2 id="NAME">NAME</h2>
73
+ <p class="man-name">
74
+ <code>brew-launchd</code> - <span class="man-whatis">Start and stop launchd services</span>
75
+ </p>
76
+
77
+ <h2 id="SYNOPSIS">SYNOPSIS</h2>
78
+
79
+ <p><code>brew</code> { start | stop | restart } [--user|--boot] service,(s) ...<br />
80
+ <code>brew launchd</code> default { --user | --boot }<br />
81
+ <code>brew launchd</code> info [ service,(s) ] ...<br />
82
+ <code>brew launchd</code> clean<br />
83
+ <code>brew launchd</code> { --help | --version }</p>
84
+
85
+ <h2 id="SERVICES">SERVICES</h2>
86
+
87
+ <dl>
88
+ <dt><code>formula_name</code></dt><dd><p>The brew formula name. Internally expanded into a list of Launchd job labels.</p></dd>
89
+ <dt><code>com.launchd.job.label[.plist]</code></dt><dd><p>The name of the Launchd job label. Also the plist filename. Useful when a formula has installed multiple launchd services (sub-services).</p></dd>
90
+ </dl>
91
+
92
+
93
+ <h2 id="DESCRIPTION">DESCRIPTION</h2>
94
+
95
+ <p>Brew-launchd is an extension to Homebrew to start and stop Launchd services.</p>
96
+
97
+ <p>The launchd service status of a brew formula is managed by symlinks. When a formula is installed, any launchd plists are linked into <em>$HOMEBREW_PREFIX/Library/LaunchDaemons</em>. Later, when a service is started, those symlinks are redirected to the target LaunchDaemons folder (as per --user / --boot). Launchctl is then called to bring the service up/down.</p>
98
+
99
+ <p>If a running service is deleted or uninstalled, it should be stopped first with <code>brew stop</code>. Otherwise the launchd database will be left in a state which is inconsistent with the symlinks in <em>$HOMEBREW_PREFIX/Library/LaunchDaemons</em>. However the auto clean feature will recover from the majority of such situations.</p>
100
+
101
+ <p><code>Sudo</code> is absolutely required to install boot-time services. The corresponding keg will be <code>chown -R'd</code> to <code>root:wheel</code>. This is a strict requirement of Apple's Launchd. When the service is stopped, the keg is chown'ed back to user ownership of the enclosing folder.</p>
102
+
103
+ <h2 id="OPTIONS">OPTIONS</h2>
104
+
105
+ <dl>
106
+ <dt><code>start</code> [--user|--boot] service,(s) ...</dt><dd><p>Start launchd services. Equivalent to launchctl load -w files...</p></dd>
107
+ <dt><code>stop</code> [--user|--boot] service,(s) ...</dt><dd><p>Stop launchd services. Equivalent to launchctl unload -w files...</p></dd>
108
+ <dt><code>restart</code> [--user|--boot] service,(s) ...</dt><dd><p>Restart launchd services.</p></dd>
109
+ <dt class="flush"><code>--user</code></dt><dd><p>Start at user login. Otherwise, the default setting will be used.</p></dd>
110
+ <dt class="flush"><code>--boot</code></dt><dd><p>Start at boot time. Requires sudo / root privelidges. Otherwise, the default setting will be used.</p></dd>
111
+ <dt><code>info</code> [ service,(s) ] ...</dt><dd><p>Info for launchd services. With no arguments, print info for all installed services.</p></dd>
112
+ <dt class="flush"><code>clean</code></dt><dd><p>Clean missing/broken launchd services.</p></dd>
113
+ <dt><code>default</code> { --user | --boot }</dt><dd><p>Set the default target for launchd services. Defaults to --user, which will start daemons at user login (ie via Loginwindow, not ssh). Whearas --boot will ensure all services are set to start at boot time. This option can be overriden on a case-by-case basis.</p></dd>
114
+ <dt class="flush"><code>--help</code></dt><dd><p>Show help summary</p></dd>
115
+ <dt><code>--version</code></dt><dd><p>Print version information</p></dd>
116
+ </dl>
117
+
118
+
119
+ <h2 id="BUGS">BUGS</h2>
120
+
121
+ <p> The upstreams BTS can be found at <a href="http://github.com/dreamcat4/brew-launchd/issues" data-bare-link="true">http://github.com/dreamcat4/brew-launchd/issues</a>.</p>
122
+
123
+ <h2 id="SEE-ALSO">SEE ALSO</h2>
124
+
125
+ <p> <span class="man-ref">brew<span class="s">(1)</span></span>, <span class="man-ref">launchctl<span class="s">(1)</span></span>, <span class="man-ref">launchd<span class="s">(8)</span></span>, <span class="man-ref">launchd.plist<span class="s">(5)</span></span></p>
126
+
127
+ <h2 id="Author">Author</h2>
128
+
129
+ <p> Copyright (C) 2010 Dreamcat4. See LICENSE for details.</p>
130
+
131
+
132
+ <ol class='man-decor man-foot man foot'>
133
+ <li class='tl'>Homebrew</li>
134
+ <li class='tc'>August 2010</li>
135
+ <li class='tr'>brew-launchd(1)</li>
136
+ </ol>
137
+
138
+ </div>
139
+ </body>
140
+ </html>
@@ -0,0 +1,71 @@
1
+ brew-launchd(1) -- Start and stop launchd services
2
+ ==================================================
3
+
4
+ ## SYNOPSIS
5
+
6
+ `brew` { start | stop | restart } [--user|--boot] service,(s) ...
7
+ `brew launchd` default { --user | --boot }
8
+ `brew launchd` info [ service,(s) ] ...
9
+ `brew launchd` clean
10
+ `brew launchd` { --help | --version }
11
+
12
+ ## SERVICES
13
+
14
+ * `formula_name`:
15
+ The brew formula name. Internally expanded into a list of Launchd job labels.
16
+
17
+ * `com.launchd.job.label[.plist]`:
18
+ The name of the Launchd job label. Also the plist filename. Useful when a formula has installed multiple launchd services (sub-services).
19
+
20
+ ## DESCRIPTION
21
+
22
+ Brew-launchd is an extension to Homebrew to start and stop Launchd services.
23
+
24
+ The launchd service status of a brew formula is managed by symlinks. When a formula is installed, any launchd plists are linked into _$HOMEBREW_PREFIX/Library/LaunchDaemons_. Later, when a service is started, those symlinks are redirected to the target LaunchDaemons folder (as per --user / --boot). Launchctl is then called to bring the service up/down.
25
+
26
+ If a running service is deleted or uninstalled, it should be stopped first with `brew stop`. Otherwise the launchd database will be left in a state which is inconsistent with the symlinks in _$HOMEBREW_PREFIX/Library/LaunchDaemons_. However the auto clean feature will recover from the majority of such situations.
27
+
28
+ `Sudo` is absolutely required to install boot-time services. The corresponding keg will be `chown -R'd` to `root:wheel`. This is a strict requirement of Apple's Launchd. When the service is stopped, the keg is chown'ed back to user ownership of the enclosing folder.
29
+
30
+ ## OPTIONS
31
+
32
+ * `start` [--user|--boot] service,(s) ...:
33
+ Start launchd services. Equivalent to launchctl load -w files...
34
+
35
+ * `stop` [--user|--boot] service,(s) ...:
36
+ Stop launchd services. Equivalent to launchctl unload -w files...
37
+
38
+ * `restart` [--user|--boot] service,(s) ...:
39
+ Restart launchd services.
40
+
41
+ * `--user`:
42
+ Start at user login. Otherwise, the default setting will be used.
43
+
44
+ * `--boot`:
45
+ Start at boot time. Requires sudo / root privelidges. Otherwise, the default setting will be used.
46
+
47
+ * `info` [ service,(s) ] ...:
48
+ Info for launchd services. With no arguments, print info for all installed services.
49
+
50
+ * `clean`:
51
+ Clean missing/broken launchd services.
52
+
53
+ * `default` { --user | --boot }:
54
+ Set the default target for launchd services. Defaults to --user, which will start daemons at user login (ie via Loginwindow, not ssh). Whearas --boot will ensure all services are set to start at boot time. This option can be overriden on a case-by-case basis.
55
+
56
+ * `--help`:
57
+ Show help summary
58
+
59
+ * `--version`:
60
+ Print version information
61
+
62
+ ## BUGS
63
+ The upstreams BTS can be found at <http://github.com/dreamcat4/brew-launchd/issues>.
64
+
65
+ ## SEE ALSO
66
+ brew(1), launchctl(1), launchd(8), launchd.plist(5)
67
+
68
+ ## Author
69
+
70
+ Copyright (C) 2010 Dreamcat4. See LICENSE for details.
71
+
@@ -0,0 +1,37 @@
1
+
2
+ require 'spec_helper'
3
+ require "launchr/application"
4
+
5
+ describe Launchr::Application, "#initialize" do
6
+ before(:each) do
7
+ @cli = Launchr::CLI.new
8
+ Launchr::CLI.stub(:new).and_return(@cli)
9
+ @mixlib_cli_args = {}
10
+ @cli.stub(:parse).and_return(@mixlib_cli_args)
11
+
12
+ @commands = Launchr::Commands.new
13
+ Launchr::Commands.stub(:new).and_return(@commands)
14
+
15
+ @application = Launchr::Application.new
16
+ end
17
+
18
+ it "should set Launchr::Config[:args] to a Hash" do
19
+ Launchr::Config[:args].should be_a_kind_of(Hash)
20
+ end
21
+
22
+ it "should set @cli to a Launchr::CLI object" do
23
+ @application.instance_eval { @cli }.should be_a_kind_of(Launchr::CLI)
24
+ end
25
+
26
+ it "should set @commands to a Launchr::Commands object" do
27
+ @application.instance_eval { @commands }.should be_a_kind_of(Launchr::Commands)
28
+ end
29
+
30
+ it "should follow the default calling path" do
31
+ @cli.should_receive(:parse)
32
+ Launchr::Config.should_receive(:[]=).with(:args,@mixlib_cli_args)
33
+ @commands.should_receive(:run)
34
+ @application.instance_eval { initialize }
35
+ end
36
+ end
37
+
@@ -0,0 +1,25 @@
1
+
2
+ require 'spec_helper'
3
+ require "launchr/cli"
4
+
5
+ describe Launchr::CLI, "#launchr_cli_options" do
6
+ it "should call option to define cli options" do
7
+ Launchr::CLI.should_receive(:option).at_least(:once)
8
+ Launchr::CLI.launchr_cli_options
9
+ end
10
+ end
11
+
12
+ describe Launchr::CLI, "#parse" do
13
+ before(:each) do
14
+ @cli = Launchr::CLI.new
15
+ @cli.stub(:parse_options)
16
+ @cli.stub(:config)
17
+ @argv = ["arg1","arg2","etc..."]
18
+ end
19
+
20
+ it "should follow the default calling path" do
21
+ @cli.should_receive(:parse_options).with(@argv)
22
+ @cli.should_receive(:config)
23
+ @cli.parse(@argv)
24
+ end
25
+ end
@@ -0,0 +1,20 @@
1
+
2
+ require 'spec_helper'
3
+ require "launchr/commands"
4
+
5
+ describe Launchr::Commands, "#run" do
6
+ before(:each) do
7
+ Launchr::Config[:args] = { :ruby_lib => true }
8
+ @commands = Launchr::Commands.new
9
+ @commands.stub(:ruby_lib)
10
+ end
11
+ it "should follow the default calling path" do
12
+ Launchr::Commands::PriorityOrder.should_receive(:each).and_yield(:ruby_lib)
13
+ Launchr::Config[:args].should_receive(:[]).with(:ruby_lib).and_return(true)
14
+ Launchr::Config[:args].should_receive(:keys).and_return([:ruby_lib])
15
+ Launchr::Config[:args].should_receive(:each).and_yield(:ruby_lib,true)
16
+ @commands.run
17
+ end
18
+ end
19
+
20
+
@@ -0,0 +1,38 @@
1
+
2
+ require 'spec_helper'
3
+
4
+ describe Launchr::Config, "#default_backends" do
5
+ describe "when the supplied sym is :brew" do
6
+ it "should return the RubyCocoa backend" do
7
+ Launchr::Config.default_backends(:brew).should == ["ruby_cocoa"]
8
+ end
9
+ end
10
+
11
+ describe "when the supplied sym is nil" do
12
+
13
+ describe "when there is no File at the path CoreFoundationFramework" do
14
+ it "should return DefaultBackendsAny" do
15
+ File.stub(:exists?).with(Launchr::Config::CoreFoundationFramework).and_return(false)
16
+ Launchr::Config.default_backends.should == Launchr::Config::DefaultBackendsAny
17
+ end
18
+ end
19
+
20
+ describe "when there is a File at the path CoreFoundationFramework" do
21
+ describe "when there is a File at the path RubycocoaFramework" do
22
+ it "should return DefaultBackendsOsx + the RubyCocoa backend" do
23
+ File.stub(:exists?).with(Launchr::Config::CoreFoundationFramework).and_return(true)
24
+ File.stub(:exists?).with(Launchr::Config::RubycocoaFramework).and_return(true)
25
+ Launchr::Config.default_backends.should == Launchr::Config::DefaultBackendsOsx + ["ruby_cocoa"]
26
+ end
27
+ end
28
+ describe "when there is no File at the path RubycocoaFramework" do
29
+ it "should return DefaultBackendsOsx" do
30
+ File.stub(:exists?).with(Launchr::Config::CoreFoundationFramework).and_return(true)
31
+ File.stub(:exists?).with(Launchr::Config::RubycocoaFramework).and_return(false)
32
+ Launchr::Config.default_backends.should == Launchr::Config::DefaultBackendsOsx
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
38
+
@@ -0,0 +1,7 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "Launchr" do
4
+ it "fails" do
5
+ fail "hey buddy, you should probably rename this file and start specing for real"
6
+ end
7
+ end
data/spec/spec.opts ADDED
@@ -0,0 +1 @@
1
+ --color