2009-10-15 08:07:12 +00:00
|
|
|
require 'formula'
|
2009-08-30 00:07:52 +00:00
|
|
|
|
2011-03-10 05:11:03 +00:00
|
|
|
class Memcached < Formula
|
2012-02-06 04:36:20 +00:00
|
|
|
url "http://memcached.googlecode.com/files/memcached-1.4.13.tar.gz"
|
2011-09-05 05:11:54 +00:00
|
|
|
homepage 'http://memcached.org/'
|
2012-02-06 04:36:20 +00:00
|
|
|
sha1 'd9a48d222de53a2603fbab6156d48d0e8936ee92'
|
2009-08-30 00:07:52 +00:00
|
|
|
|
2009-09-18 18:16:39 +00:00
|
|
|
depends_on 'libevent'
|
2009-08-30 00:07:52 +00:00
|
|
|
|
2011-01-12 18:12:31 +00:00
|
|
|
def options
|
|
|
|
[
|
|
|
|
["--enable-sasl", "Enable SASL support -- disables ASCII protocol!"],
|
2011-12-16 20:04:05 +00:00
|
|
|
["--enable-sasl-pwdb", "Enable SASL with memcached's own plain text password db support -- disables ASCII protocol!"],
|
2011-01-12 18:12:31 +00:00
|
|
|
]
|
|
|
|
end
|
|
|
|
|
2009-08-30 00:07:52 +00:00
|
|
|
def install
|
2011-01-12 18:12:31 +00:00
|
|
|
args = ["--prefix=#{prefix}"]
|
|
|
|
args << "--enable-sasl" if ARGV.include? "--enable-sasl"
|
2011-12-16 20:04:05 +00:00
|
|
|
args << "--enable-sasl-pwdb" if ARGV.include? "--enable-sasl-pwdb"
|
2011-01-12 18:12:31 +00:00
|
|
|
|
|
|
|
system "./configure", *args
|
2009-08-30 00:07:52 +00:00
|
|
|
system "make install"
|
2009-11-05 09:18:23 +00:00
|
|
|
|
2011-12-31 05:56:52 +00:00
|
|
|
plist_path.write startup_plist
|
|
|
|
plist_path.chmod 0644
|
2009-11-05 09:18:23 +00:00
|
|
|
end
|
|
|
|
|
2011-03-04 20:05:38 +00:00
|
|
|
def caveats; <<-EOS.undent
|
|
|
|
You can enable memcached to automatically load on login with:
|
2011-02-27 08:07:58 +00:00
|
|
|
mkdir -p ~/Library/LaunchAgents
|
2011-12-31 05:56:52 +00:00
|
|
|
cp #{plist_path} ~/Library/LaunchAgents/
|
|
|
|
launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename}
|
2009-11-05 09:18:23 +00:00
|
|
|
|
2012-02-04 14:57:53 +00:00
|
|
|
If this is an upgrade and you already have the #{plist_path.basename} loaded:
|
2011-12-31 05:56:52 +00:00
|
|
|
launchctl unload -w ~/Library/LaunchAgents/#{plist_path.basename}
|
2012-02-04 14:57:53 +00:00
|
|
|
cp #{plist_path} ~/Library/LaunchAgents/
|
2011-12-31 05:56:52 +00:00
|
|
|
launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename}
|
2011-11-11 11:39:47 +00:00
|
|
|
|
|
|
|
Or start it manually:
|
|
|
|
#{HOMEBREW_PREFIX}/bin/memcached
|
2009-11-05 09:18:23 +00:00
|
|
|
|
2011-11-11 11:39:47 +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>
|
2011-12-31 05:56:52 +00:00
|
|
|
<string>#{plist_name}</string>
|
2009-11-05 09:18:23 +00:00
|
|
|
<key>KeepAlive</key>
|
|
|
|
<true/>
|
|
|
|
<key>ProgramArguments</key>
|
|
|
|
<array>
|
|
|
|
<string>#{HOMEBREW_PREFIX}/bin/memcached</string>
|
2010-05-10 14:11:08 +00:00
|
|
|
<string>-l</string>
|
2011-03-01 12:50:27 +00:00
|
|
|
<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
|