aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/pgtune.rb
blob: 2791861efff3c66391d46ec6ba8f6d1e38675afd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
require 'formula'

class Pgtune < Formula
  homepage 'http://pgfoundry.org/projects/pgtune'
  url 'http://pgfoundry.org/frs/download.php/2449/pgtune-0.9.3.tar.gz'
  sha1 'c638ee3be7bd33f313c280cff9dee2d47bb40e46'

  # 0.9.3 does not have settings for PostgreSQL 9.x, but the trunk does
  head 'https://github.com/gregs1104/pgtune.git'

  def install
    # By default, pgtune searches for settings in the directory
    # where the script is being run from. We replace the default
    # path with pgtune_share.
    pgtune_share = share/'pgtune'
    inreplace 'pgtune' do |s|
      s.sub! /(parser\.add_option\('-S'.*default=).*,/, "\\1\"#{pgtune_share}\","
    end
    bin.install 'pgtune'
    pgtune_share.install Dir['pg_settings*']
  end
end