58 lines
1.8 KiB
Ruby
58 lines
1.8 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.12.tar.gz"
|
|
sha256 "c02f97d5685617b209fbe25f3464317b234d765b427d254c2413410a5c095b29"
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "50b40699e0f7f2fc8e2879f02fc331a6b43b75ab8a07412c80ab5c80e9a96b63" => :mojave
|
|
sha256 "7a901c44052f9e688dd39268bb023e16319a77526d6fd12de0b3d607c90f396f" => :high_sierra
|
|
sha256 "40335eedfc0f7ec9468d208818effa410ebdf589f0a30fe3f672d3ded1f81476" => :sierra
|
|
end
|
|
|
|
depends_on "libevent"
|
|
|
|
conflicts_with "mysql-cluster", :because => "both install `bin/memcached`"
|
|
|
|
def install
|
|
system "./configure", "--prefix=#{prefix}", "--disable-coverage"
|
|
system "make", "install"
|
|
end
|
|
|
|
plist_options :manual => "#{HOMEBREW_PREFIX}/opt/memcached/bin/memcached"
|
|
|
|
def plist; <<~EOS
|
|
<?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
|