Skip to content

Commit 974a201

Browse files
committed
hypopg 1.4.1 (new formula)
1 parent 2b8f8fe commit 974a201

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

Formula/h/hypopg.rb

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
class Hypopg < Formula
2+
desc "Hypothetical Indexes for PostgreSQL"
3+
homepage "https://github.com/HypoPG/hypopg"
4+
url "https://github.com/HypoPG/hypopg/archive/refs/tags/1.4.1.tar.gz"
5+
sha256 "9afe6357fd389d8d33fad81703038ce520b09275ec00153c6c89282bcdedd6bc"
6+
license "PostgreSQL"
7+
8+
depends_on "postgresql@14" => [:build, :test]
9+
depends_on "postgresql@17" => [:build, :test]
10+
11+
def postgresqls
12+
deps.map(&:to_formula).sort_by(&:version).filter { |f| f.name.start_with?("postgresql@") }
13+
end
14+
15+
def install
16+
postgresqls.each do |postgresql|
17+
ENV["PG_CONFIG"] = postgresql.opt_bin/"pg_config"
18+
system "make"
19+
system "make", "install", "pkglibdir=#{lib/postgresql.name}",
20+
"datadir=#{share/postgresql.name}",
21+
"pkgincludedir=#{include/postgresql.name}"
22+
system "make", "clean"
23+
end
24+
end
25+
26+
test do
27+
ENV["LC_ALL"] = "C"
28+
postgresqls.each do |postgresql|
29+
pg_ctl = postgresql.opt_bin/"pg_ctl"
30+
psql = postgresql.opt_bin/"psql"
31+
port = free_port
32+
33+
datadir = testpath/postgresql.name
34+
system pg_ctl, "initdb", "-D", datadir
35+
(datadir/"postgresql.conf").write <<~EOS, mode: "a+"
36+
port = #{port}
37+
EOS
38+
system pg_ctl, "start", "-D", datadir, "-l", testpath/"log-#{postgresql.name}"
39+
begin
40+
system psql, "-p", port.to_s, "-c", "CREATE EXTENSION hypopg;", "postgres"
41+
ensure
42+
system pg_ctl, "stop", "-D", datadir
43+
end
44+
end
45+
end
46+
end

0 commit comments

Comments
 (0)