pgpool-ii: use a Requirement for Postgres

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
master
Jack Nagel 2012-05-07 20:56:31 -05:00
parent 89af76d0d9
commit e433ffcf53
1 changed files with 22 additions and 11 deletions

View File

@ -1,21 +1,32 @@
require 'formula'
class PostgresqlInstalled < Requirement
def message; <<-EOS.undent
PostgresQL is required to install.
You can install this with:
brew install postgresql
Or you can use an official installer from:
http://www.postgresql.org/
EOS
end
def satisfied?
which 'pg_config'
end
def fatal?
true
end
end
class PgpoolIi < Formula
url 'http://pgfoundry.org/frs/download.php/2841/pgpool-II-3.0.1.tar.gz'
homepage 'http://pgpool.projects.postgresql.org/'
url 'http://pgfoundry.org/frs/download.php/2841/pgpool-II-3.0.1.tar.gz'
md5 '86d8beff0396d11b6753dd2be31bcad7'
def install
if `/usr/bin/which pg_config`.chomp.empty?
opoo "No PostgreSQL was detected."
puts <<-EOS.undent
This formula uses `pg_config` to detect an installed PostgreSQL instead
of "depends_on 'postgresql'" so you can use a non-Homebrew version.
You may want to `brew install postgresql` if you don't have another
version already installed.
EOS
end
depends_on PostgresqlInstalled.new
def install
system "./configure", "--prefix=#{prefix}", "--mandir=#{man}"
system "make install"
end