homebrew-core/Formula/memcached.rb

70 lines
1.9 KiB
Ruby
Raw Normal View History

require 'formula'
2009-08-30 00:07:52 +00:00
2011-03-10 05:11:03 +00:00
class Memcached < Formula
2011-11-11 03:03:50 +00:00
url "http://memcached.googlecode.com/files/memcached-1.4.10.tar.gz"
homepage 'http://memcached.org/'
2011-11-11 03:03:50 +00:00
sha1 '0ae300f858b767abf812009d53ed58647ceb498a'
2009-08-30 00:07:52 +00:00
depends_on 'libevent'
2009-08-30 00:07:52 +00:00
def options
[
["--enable-sasl", "Enable SASL support -- disables ASCII protocol!"],
]
end
2009-08-30 00:07:52 +00:00
def install
args = ["--prefix=#{prefix}"]
args << "--enable-sasl" if ARGV.include? "--enable-sasl"
system "./configure", *args
2009-08-30 00:07:52 +00:00
system "make install"
2009-11-05 09:18:23 +00:00
(prefix+'com.danga.memcached.plist').write startup_plist
2011-09-02 21:41:57 +00:00
(prefix+'com.danga.memcached.plist').chmod 0644
2009-11-05 09:18:23 +00:00
end
def caveats; <<-EOS.undent
You can enable memcached to automatically load on login with:
mkdir -p ~/Library/LaunchAgents
cp #{prefix}/com.danga.memcached.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/com.danga.memcached.plist
2009-11-05 09:18:23 +00:00
If this is an upgrade and you already have the com.danga.memcached.plist loaded:
launchctl unload -w ~/Library/LaunchAgents/com.danga.memcached.plist
cp #{prefix}/com.danga.memcached.plist ~/Library/LaunchAgents/com.danga.memcached.plist
launchctl load -w ~/Library/LaunchAgents/com.danga.memcached.plist
Or start it manually:
#{HOMEBREW_PREFIX}/bin/memcached
2009-11-05 09:18:23 +00:00
Add "-d" to start it as a daemon.
2009-11-05 09:18:23 +00:00
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>
2009-11-05 09:18:23 +00:00
</array>
<key>RunAtLoad</key>
<true/>
<key>WorkingDirectory</key>
<string>#{HOMEBREW_PREFIX}</string>
</dict>
</plist>
EOPLIST
2009-08-30 00:07:52 +00:00
end
end