75 lines
2.3 KiB
Ruby
75 lines
2.3 KiB
Ruby
class RedisAT40 < Formula
|
|
desc "Persistent key-value database, with built-in net interface"
|
|
homepage "https://redis.io/"
|
|
url "https://github.com/antirez/redis/archive/4.0.14.tar.gz"
|
|
sha256 "3b8c6ea4c9db944fe6ec427c1b11d912ca6c5c5e17ee4cfaea98bbda90724752"
|
|
license "BSD-3-Clause"
|
|
revision 1
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "a3da3a3af97a3ca5c36c2399defd06e6cbbd0b105980b2d626f224e384adc017" => :catalina
|
|
sha256 "3cbcec571f8c420f2f6daacbef87ed462229f31e4d189be36bee7795a25fc050" => :mojave
|
|
sha256 "e2c6a35a448d8a5bc23182d07a499e7005681d522131253d9087de9c091ba8f5" => :high_sierra
|
|
end
|
|
|
|
keg_only :versioned_formula
|
|
|
|
deprecate!
|
|
|
|
def install
|
|
system "make", "install", "PREFIX=#{prefix}", "CC=#{ENV.cc}"
|
|
|
|
%w[run db/redis log].each { |p| (var/p).mkpath }
|
|
|
|
# Fix up default conf file to match our paths
|
|
inreplace "redis.conf" do |s|
|
|
s.gsub! "/var/run/redis.pid", var/"run/redis.pid"
|
|
s.gsub! "dir ./", "dir #{var}/db/redis/"
|
|
s.sub! /^bind .*$/, "bind 127.0.0.1 ::1"
|
|
end
|
|
|
|
etc.install "redis.conf"
|
|
etc.install "sentinel.conf" => "redis-sentinel.conf"
|
|
end
|
|
|
|
plist_options manual: "#{HOMEBREW_PREFIX}/opt/redis@4.0/bin/redis-server #{HOMEBREW_PREFIX}/etc/redis.conf"
|
|
|
|
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>KeepAlive</key>
|
|
<dict>
|
|
<key>SuccessfulExit</key>
|
|
<false/>
|
|
</dict>
|
|
<key>Label</key>
|
|
<string>#{plist_name}</string>
|
|
<key>ProgramArguments</key>
|
|
<array>
|
|
<string>#{opt_bin}/redis-server</string>
|
|
<string>#{etc}/redis.conf</string>
|
|
<string>--daemonize no</string>
|
|
</array>
|
|
<key>RunAtLoad</key>
|
|
<true/>
|
|
<key>WorkingDirectory</key>
|
|
<string>#{var}</string>
|
|
<key>StandardErrorPath</key>
|
|
<string>#{var}/log/redis.log</string>
|
|
<key>StandardOutPath</key>
|
|
<string>#{var}/log/redis.log</string>
|
|
</dict>
|
|
</plist>
|
|
EOS
|
|
end
|
|
|
|
test do
|
|
system bin/"redis-server", "--test-memory", "2"
|
|
%w[run db/redis log].each { |p| assert_predicate var/p, :exist?, "#{var/p} doesn't exist!" }
|
|
end
|
|
end
|