aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/pgtap.rb
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Formula/pgtap.rb')
-rw-r--r--Library/Formula/pgtap.rb33
1 files changed, 20 insertions, 13 deletions
diff --git a/Library/Formula/pgtap.rb b/Library/Formula/pgtap.rb
index 16415304a..fc5149253 100644
--- a/Library/Formula/pgtap.rb
+++ b/Library/Formula/pgtap.rb
@@ -1,25 +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 Pgtap < Formula
url 'http://pgfoundry.org/frs/download.php/2701/pgtap-0.24.tar.bz2'
homepage 'http://pgtap.org'
md5 '9d0360c87fca0ddf3ca9da49b9b71947'
- skip_clean :all
+ depends_on PostgresqlInstalled.new
def install
- unless which 'pg_config'
- opoo "No pg_config was detected."
- puts <<-EOS.undent
- pg_top requires postgresql in order to compile, but pg_config was not
- found. This install will likely fail.
-
- You can install this with:
- brew install postgresql
- or by using a package installer from the PostgreSQL project itself.
- EOS
- end
-
system "make install"
bin.install %w(bbin/pg_prove bbin/pg_tapgen)
end