webdis: add plist file

Also, do not daemonize when using launchd.

Closes #7671.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
This commit is contained in:
Rakesh 2016-12-08 12:44:17 +00:00 committed by Mike McQuaid
parent 29f254175a
commit 44aea641c0

View file

@ -18,7 +18,11 @@ class Webdis < Formula
system "make" system "make"
bin.install "webdis" bin.install "webdis"
inreplace "webdis.prod.json", "/var/log/webdis.log", "#{var}/log/webdis.log" inreplace "webdis.prod.json" do |s|
s.gsub! "/var/log/webdis.log", "#{var}/log/webdis.log"
s.gsub! /daemonize":\s*true/, "daemonize\":\tfalse"
end
etc.install "webdis.json", "webdis.prod.json" etc.install "webdis.json", "webdis.prod.json"
end end
@ -26,6 +30,34 @@ class Webdis < Formula
(var/"log").mkpath (var/"log").mkpath
end end
plist_options :manual => "webdis #{HOMEBREW_PREFIX}/etc/webdis.json"
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>Label</key>
<string>#{plist_name}</string>
<key>ProgramArguments</key>
<array>
<string>#{opt_bin}/webdis</string>
<string>#{etc}/webdis.prod.json</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<dict>
<key>SuccessfulExit</key>
<false/>
</dict>
<key>WorkingDirectory</key>
<string>#{var}</string>
</dict>
</plist>
EOS
end
test do test do
begin begin
server = fork do server = fork do