homebrew-core/Formula/pgbouncer.rb
2016-09-30 19:52:46 -04:00

71 lines
2.4 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.7.2/pgbouncer-1.7.2.tar.gz"
sha256 "de36b318fe4a2f20a5f60d1c5ea62c1ca331f6813d2c484866ecb59265a160ba"
bottle do
cellar :any
sha256 "f1b22cffe62914e51387e902f7ed8dd7ff2d43c65723abf5f22c97f6c32fa25f" => :sierra
sha256 "f0a7e86e73f82b123b993491ed593e3a3683e4de80180c6b412f40e1c7426b1b" => :el_capitan
sha256 "e92de7aa798c662214aa866f1160226a941df217a90081080daccfd6b91d0ade" => :yosemite
sha256 "5934355f560dbbddd7e0caf8b1e7c861debb1e9a96d8575461971689ca90a875" => :mavericks
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.undent
The config file: #{etc}/pgbouncer.ini is in the "ini" format and you
will need to edit it for your particular setup. See:
http://pgbouncer.projects.postgresql.org/doc/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.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>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