68 lines
2.3 KiB
Ruby
68 lines
2.3 KiB
Ruby
class Memcached < Formula
|
|
desc "High performance, distributed memory object caching system"
|
|
homepage "https://memcached.org/"
|
|
url "https://www.memcached.org/files/memcached-1.5.0.tar.gz"
|
|
sha256 "c001f812024bb461b5e4d7d0506daab63dff9614eea26f46536c3b7e1e601c32"
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "fb390a87a44bd89f281e51c0c7b97c0ecd96563cbf1bbf5e74dd322c97c2cf94" => :sierra
|
|
sha256 "df17c1f2e4dba8c70e1ba7b0e5f47c6dfe2e5edf240ff036756226089062292a" => :el_capitan
|
|
sha256 "4f74ff764fa09d840fd2826d4d65521a2168a8f69d4f9150371781f7ba20351f" => :yosemite
|
|
end
|
|
|
|
option "with-sasl", "Enable SASL support -- disables ASCII protocol!"
|
|
option "with-sasl-pwdb", "Enable SASL with memcached's own plain text password db support -- disables ASCII protocol!"
|
|
|
|
depends_on "libevent"
|
|
|
|
deprecated_option "enable-sasl" => "with-sasl"
|
|
deprecated_option "enable-sasl-pwdb" => "with-sasl-pwdb"
|
|
|
|
conflicts_with "mysql-cluster", :because => "both install `bin/memcached`"
|
|
|
|
def install
|
|
args = ["--prefix=#{prefix}", "--disable-coverage"]
|
|
args << "--enable-sasl" if build.with? "sasl"
|
|
args << "--enable-sasl-pwdb" if build.with? "sasl-pwdb"
|
|
|
|
system "./configure", *args
|
|
system "make", "install"
|
|
end
|
|
|
|
plist_options :manual => "#{HOMEBREW_PREFIX}/opt/memcached/bin/memcached"
|
|
|
|
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>KeepAlive</key>
|
|
<true/>
|
|
<key>ProgramArguments</key>
|
|
<array>
|
|
<string>#{opt_bin}/memcached</string>
|
|
<string>-l</string>
|
|
<string>localhost</string>
|
|
</array>
|
|
<key>RunAtLoad</key>
|
|
<true/>
|
|
<key>WorkingDirectory</key>
|
|
<string>#{HOMEBREW_PREFIX}</string>
|
|
</dict>
|
|
</plist>
|
|
EOS
|
|
end
|
|
|
|
test do
|
|
pidfile = testpath/"memcached.pid"
|
|
# Assumes port 11211 is not already taken
|
|
system bin/"memcached", "--listen=localhost:11211", "--daemon", "--pidfile=#{pidfile}"
|
|
sleep 1
|
|
assert_predicate pidfile, :exist?, "Failed to start memcached daemon"
|
|
pid = (testpath/"memcached.pid").read.chomp.to_i
|
|
Process.kill "TERM", pid
|
|
end
|
|
end
|