aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/check_postgres.rb
blob: 84a59a12b9742e1830c26dd0a63849cf2de457d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
require "formula"

class CheckPostgres < Formula
  homepage "http://bucardo.org/wiki/Check_postgres"
  url "http://bucardo.org/downloads/check_postgres-2.21.0.tar.gz"
  sha1 "88ddb1c35a8da0feeaad90036dd27d778551a36d"

  head "https://github.com/bucardo/check_postgres.git"

  bottle do
    cellar :any
    sha1 "ff1c0bf88f5db93a9c71e583a8d9675e2db9a0dd" => :mavericks
    sha1 "5de05e3422ee2af8eb25767048a5b5e1fd4b8421" => :mountain_lion
    sha1 "d2d291e11a3720a3d0d8fce6d3409457055bee3c" => :lion
  end

  depends_on :postgresql

  def install
    system "perl", "Makefile.PL", "PREFIX=#{prefix}"
    system "make", "install"
    mv bin/"check_postgres.pl", bin/"check_postgres"
    inreplace [bin/"check_postgres", man1/"check_postgres.1p"], "check_postgres.pl", "check_postgres"
    rm_rf prefix/"Library"
    rm_rf prefix/"lib"
  end

  test do
    # This test verifies that check_postgres fails correctly, assuming
    # that no server is running at that port.
    output = shell_output("#{bin}/check_postgres --action=connection --port=65432", 2)
    assert output.include? "POSTGRES_CONNECTION CRITICAL"
  end
end