72 lines
2.3 KiB
Ruby
72 lines
2.3 KiB
Ruby
class Pgbouncer < Formula
|
|
desc "Lightweight connection pooler for PostgreSQL"
|
|
homepage "https://wiki.postgresql.org/wiki/PgBouncer"
|
|
url "https://pgbouncer.github.io/downloads/files/1.9.0/pgbouncer-1.9.0.tar.gz"
|
|
sha256 "39eca9613398636327e79cbcbd5b41115035bca9ca1bd3725539646468825f04"
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "ff4be2490697fe770c31b0daee18fae4c8911652162dd7590c36e6c10f645f91" => :mojave
|
|
sha256 "ef9421f5cb50c9ac632151f5058f78976fcd80dbb395fca5344a849e497368ff" => :high_sierra
|
|
sha256 "1913c8bc33932cb10583a2cbbb37735345db29a2d84571c4f137d0d9d9c68336" => :sierra
|
|
sha256 "2bd0cd45ec8291fbf9db4965a50a063a9d6b2137f6ef160170a07bdb7a068629" => :el_capitan
|
|
end
|
|
|
|
depends_on "asciidoc" => :build
|
|
depends_on "xmlto" => :build
|
|
depends_on "libevent"
|
|
|
|
def install
|
|
ENV["XML_CATALOG_FILES"] = "#{etc}/xml/catalog"
|
|
|
|
system "./configure", "--disable-debug",
|
|
"--with-libevent=#{HOMEBREW_PREFIX}",
|
|
"--prefix=#{prefix}"
|
|
ln_s "../install-sh", "doc/install-sh"
|
|
system "make", "install"
|
|
bin.install "etc/mkauth.py"
|
|
etc.install %w[etc/pgbouncer.ini etc/userlist.txt]
|
|
end
|
|
|
|
def caveats; <<~EOS
|
|
The config file: #{etc}/pgbouncer.ini is in the "ini" format and you
|
|
will need to edit it for your particular setup. See:
|
|
https://pgbouncer.github.io/config.html
|
|
|
|
The auth_file option should point to the #{etc}/userlist.txt file which
|
|
can be populated by the #{bin}/mkauth.py script.
|
|
EOS
|
|
end
|
|
|
|
plist_options :manual => "pgbouncer -q #{HOMEBREW_PREFIX}/etc/pgbouncer.ini"
|
|
|
|
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>
|
|
<true/>
|
|
<key>Label</key>
|
|
<string>#{plist_name}</string>
|
|
<key>ProgramArguments</key>
|
|
<array>
|
|
<string>#{opt_bin}/pgbouncer</string>
|
|
<string>-d</string>
|
|
<string>-q</string>
|
|
<string>#{etc}/pgbouncer.ini</string>
|
|
</array>
|
|
<key>RunAtLoad</key>
|
|
<true/>
|
|
<key>WorkingDirectory</key>
|
|
<string>#{HOMEBREW_PREFIX}</string>
|
|
</dict>
|
|
</plist>
|
|
EOS
|
|
end
|
|
|
|
test do
|
|
assert_match version.to_s, shell_output("#{bin}/pgbouncer -V")
|
|
end
|
|
end
|