2011-05-09 10:45:52 +00:00
|
|
|
require 'formula'
|
|
|
|
|
|
|
|
class Pgbouncer < Formula
|
|
|
|
homepage 'http://wiki.postgresql.org/wiki/PgBouncer'
|
2012-10-19 03:08:05 +00:00
|
|
|
url 'http://pgfoundry.org/frs/download.php/3369/pgbouncer-1.5.3.tar.gz'
|
|
|
|
sha1 '2811d32d39cb87a64e278d985178258072c5c8ef'
|
2011-05-09 10:45:52 +00:00
|
|
|
|
2012-05-14 18:17:17 +00:00
|
|
|
depends_on 'asciidoc' => :build
|
|
|
|
depends_on 'xmlto' => :build
|
2011-05-09 10:45:52 +00:00
|
|
|
depends_on 'libevent'
|
|
|
|
|
|
|
|
def install
|
2012-05-14 18:17:17 +00:00
|
|
|
ENV['XML_CATALOG_FILES'] = "#{etc}/xml/catalog"
|
|
|
|
|
|
|
|
system "./configure", "--disable-debug",
|
2011-05-09 10:45:52 +00:00
|
|
|
"--with-libevent=#{HOMEBREW_PREFIX}",
|
|
|
|
"--prefix=#{prefix}"
|
2012-05-14 18:17:17 +00:00
|
|
|
ln_s "../install-sh", "doc/install-sh"
|
2011-05-09 10:45:52 +00:00
|
|
|
system "make install"
|
|
|
|
bin.install "etc/mkauth.py"
|
|
|
|
etc.install %w(etc/pgbouncer.ini etc/userlist.txt)
|
|
|
|
end
|
|
|
|
|
|
|
|
def caveats
|
|
|
|
s = <<-EOS
|
|
|
|
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.
|
|
|
|
|
|
|
|
If this is your first install, automatically load on login with:
|
|
|
|
mkdir -p ~/Library/LaunchAgents
|
2011-12-31 05:56:52 +00:00
|
|
|
cp #{plist_path} ~/Library/LaunchAgents/
|
|
|
|
launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename}
|
2011-05-09 10:45:52 +00:00
|
|
|
|
2012-02-04 14:57:53 +00:00
|
|
|
If this is an upgrade and you already have the #{plist_path.basename}
|
2011-05-09 10:45:52 +00:00
|
|
|
loaded:
|
2011-12-31 05:56:52 +00:00
|
|
|
launchctl unload -w ~/Library/LaunchAgents/#{plist_path.basename}
|
|
|
|
cp #{plist_path} ~/Library/LaunchAgents/
|
|
|
|
launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename}
|
2011-05-09 10:45:52 +00:00
|
|
|
|
|
|
|
Or start manually with:
|
|
|
|
pgbouncer -q #{etc}/pgbouncer.ini
|
|
|
|
EOS
|
|
|
|
end
|
|
|
|
|
|
|
|
def startup_plist
|
|
|
|
return <<-EOPLIST
|
|
|
|
<?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>
|
2011-12-31 05:56:52 +00:00
|
|
|
<string>#{plist_name}</string>
|
2011-05-09 10:45:52 +00:00
|
|
|
<key>ProgramArguments</key>
|
|
|
|
<array>
|
2011-12-31 22:13:31 +00:00
|
|
|
<string>#{HOMEBREW_PREFIX}/bin/pgbouncer</string>
|
2011-05-09 10:45:52 +00:00
|
|
|
<string>-d</string>
|
|
|
|
<string>-q</string>
|
|
|
|
<string>#{etc}/pgbouncer.ini</string>
|
|
|
|
</array>
|
|
|
|
<key>RunAtLoad</key>
|
|
|
|
<true/>
|
|
|
|
<key>UserName</key>
|
|
|
|
<string>#{`whoami`.chomp}</string>
|
|
|
|
<key>WorkingDirectory</key>
|
|
|
|
<string>#{HOMEBREW_PREFIX}</string>
|
|
|
|
</dict>
|
|
|
|
</plist>
|
|
|
|
EOPLIST
|
|
|
|
end
|
|
|
|
end
|