forked from Homebrew/legacy-homebrew
-
Notifications
You must be signed in to change notification settings - Fork 0
/
memcached.rb
62 lines (52 loc) · 1.51 KB
/
memcached.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
60
61
62
require 'formula'
class Memcached <Formula
url "http://memcached.googlecode.com/files/memcached-1.4.5.tar.gz"
homepage 'http://www.danga.com/memcached/'
sha1 'c7d6517764b82d23ae2de76b56c2494343c53f02'
depends_on 'libevent'
def options
[
["--enable-sasl", "Enable SASL support -- disables ASCII protocol!"],
]
end
def install
args = ["--prefix=#{prefix}"]
args << "--enable-sasl" if ARGV.include? "--enable-sasl"
system "./configure", *args
system "make install"
(prefix+'com.danga.memcached.plist').write startup_plist
end
def caveats; <<-EOS.undent
You can enable memcached to automatically load on login with:
cp #{prefix}/com.danga.memcached.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/com.danga.memcached.plist
Or start it manually:
#{HOMEBREW_PREFIX}/bin/memcached
Add "-d" to start it as a daemon.
EOS
end
def startup_plist
return <<-EOPLIST
<?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>com.danga.memcached</string>
<key>KeepAlive</key>
<true/>
<key>ProgramArguments</key>
<array>
<string>#{HOMEBREW_PREFIX}/bin/memcached</string>
<string>-l</string>
<string>localhost</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>WorkingDirectory</key>
<string>#{HOMEBREW_PREFIX}</string>
</dict>
</plist>
EOPLIST
end
end