class RedisAT32 < Formula desc "Persistent key-value database, with built-in net interface" homepage "https://redis.io/" url "https://download.redis.io/releases/redis-3.2.13.tar.gz" sha256 "862979c9853fdb1d275d9eb9077f34621596fec1843e3e7f2e2f09ce09a387ba" revision 1 bottle do cellar :any_skip_relocation sha256 "e557bee10881f773cfb59d593a874f628b4f7d7239acea2d9cfc1ab394619fba" => :catalina sha256 "b61b4867149efc9201c51c984a55edcd0809e8a045b372c4bbf00c3b119afea4" => :mojave sha256 "78a359ac74a02868ba481ae740d1d5046a89fc2e07020ddee6c73e491a162247" => :high_sierra end keg_only :versioned_formula deprecate! because: :versioned_formula 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.gsub! "\# bind 127.0.0.1", "bind 127.0.0.1" end etc.install "redis.conf" etc.install "sentinel.conf" => "redis-sentinel.conf" end plist_options manual: "#{HOMEBREW_PREFIX}/opt/redis@3.2/bin/redis-server #{HOMEBREW_PREFIX}/etc/redis.conf" def plist <<~EOS KeepAlive SuccessfulExit Label #{plist_name} ProgramArguments #{opt_bin}/redis-server #{etc}/redis.conf --daemonize no RunAtLoad WorkingDirectory #{var} StandardErrorPath #{var}/log/redis.log StandardOutPath #{var}/log/redis.log 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