forked from adestefan/homebrew-headonly
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdisque.rb
59 lines (51 loc) · 1.63 KB
/
disque.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
class Disque < Formula
desc "In memory distributed job queue"
homepage "https://github.com/antirez/disque"
head "https://github.com/antirez/disque.git"
def install
system "make", "PREFIX=#{prefix}", "CC=#{ENV.cc}"
bin.install "src/disque"
bin.install "src/disque-check-aof"
bin.install "src/disque-server"
%w[run db/disque log].each { |p| (var+p).mkpath }
inreplace "disque.conf" do |s|
s.gsub! "/var/run/disque.pid", "#{var}/run/disque.pid"
s.gsub! "dir ./", "dir #{var}/db/disque"
s.gsub! "\# bind 127.0.0.1", "bind 127.0.0.1"
end
etc.install "disque.conf"
end
plist_options :manual => "disque-server #{HOMEBREW_PREFIX}/etc/disque.conf"
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>
<dict>
<key>SuccessfulExit</key>
<false/>
</dict>
<key>Label</key>
<string>#{plist_name}</string>
<key>ProgramArguments</key>
<array>
<string>#{opt_bin}/disque-server</string>
<string>#{etc}/disque.conf</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>WorkingDirectory</key>
<string>#{var}</string>
<key>StandardErrorPath</key>
<string>#{var}/log/disque.log</string>
<key>StandardOutPath</key>
<string>#{var}/log/disque.log</string>
</dict>
</plist>
EOS
end
test do
system "#{bin}/disque-server", "--test-memory", "2"
end
end