aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMike McQuaid2013-06-26 19:39:55 +0100
committerMike McQuaid2013-06-26 19:46:39 +0100
commit75bdc45396e9735257ca5086b8e93bc14a71846e (patch)
treedc82b8c784d2fc2d6bc8639f56d0107a9339909c /Library
parent579f3d6170ee58f226857d7241c341fb28c1cc1c (diff)
downloadhomebrew-75bdc45396e9735257ca5086b8e93bc14a71846e.tar.bz2
couchdb: generate our own plist.
Diffstat (limited to 'Library')
-rw-r--r--Library/Formula/couchdb.rb50
1 files changed, 27 insertions, 23 deletions
diff --git a/Library/Formula/couchdb.rb b/Library/Formula/couchdb.rb
index 953f9b612..d75d9c687 100644
--- a/Library/Formula/couchdb.rb
+++ b/Library/Formula/couchdb.rb
@@ -46,42 +46,46 @@ class Couchdb < Formula
system "make"
system "make install"
- (prefix+"Library/LaunchDaemons/org.apache.couchdb.plist").chmod 0644
+ # Use our plist instead to avoid faffing with a new system user.
+ (prefix+"Library/LaunchDaemons/org.apache.couchdb.plist").delete
(lib+'couchdb/bin/couchjs').chmod 0755
(var+'lib/couchdb').mkpath
(var+'log/couchdb').mkpath
end
+ plist_options :manual => "couchdb"
+
+ def plist; <<-EOS.undent
+ <?xml version="1.0" encoding="UTF-8"?>
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+ <plist version="1.0">
+ <dict>
+ <key>KeepAlive</key>
+ <true/>
+ <key>Label</key>
+ <string>#{plist_name}</string>
+ <key>ProgramArguments</key>
+ <array>
+ <string>#{opt_prefix}/bin/couchdb</string>
+ </array>
+ <key>RunAtLoad</key>
+ <true/>
+ </dict>
+ </plist>
+ EOS
+ end
+
def test
# ensure couchdb embedded spidermonkey vm works
system "#{bin}/couchjs", "-h"
end
def caveats; <<-EOS.undent
- If this is your first install, automatically load on login with:
- mkdir -p ~/Library/LaunchAgents
- cp #{prefix}/Library/LaunchDaemons/org.apache.couchdb.plist ~/Library/LaunchAgents/
- launchctl load -w ~/Library/LaunchAgents/org.apache.couchdb.plist
-
- If this is an upgrade and you already have the org.apache.couchdb.plist loaded:
- launchctl unload -w ~/Library/LaunchAgents/org.apache.couchdb.plist
- cp #{prefix}/Library/LaunchDaemons/org.apache.couchdb.plist ~/Library/LaunchAgents/
- launchctl load -w ~/Library/LaunchAgents/org.apache.couchdb.plist
-
- Alternatively, automatically run on startup as a daemon with:
- sudo launchctl list org.apache.couchdb \>/dev/null 2\>\&1 \&\& \\
- sudo launchctl unload -w /Library/LaunchDaemons/org.apache.couchdb.plist
- sudo cp #{prefix}/Library/LaunchDaemons/org.apache.couchdb.plist /Library/LaunchDaemons/
- sudo launchctl load -w /Library/LaunchDaemons/org.apache.couchdb.plist
-
- Or start manually as the current user with `couchdb`.
-
- To test CouchDB, start `couchdb` in a terminal and then:
- curl http://127.0.0.1:5984/
+ To test CouchDB run:
+ curl http://127.0.0.1:5984/
The reply should look like:
- {"couchdb":"Welcome","uuid":"....","version":"1.3.0",
- "vendor":{"version":"1.3.0-1","name":"Homebrew"}}
+ {"couchdb":"Welcome","uuid":"....","version":"#{version}","vendor":{"version":"#{version}-1","name":"Homebrew"}}
EOS
end
end