59 lines
2.1 KiB
Ruby
59 lines
2.1 KiB
Ruby
class TemporalTables < Formula
|
|
desc "Temporal Tables PostgreSQL Extension"
|
|
homepage "https://pgxn.org/dist/temporal_tables/"
|
|
url "https://github.com/arkhipov/temporal_tables/archive/v1.2.0.tar.gz"
|
|
sha256 "e6d1b31a124e8597f61b86f08b6a18168f9cd9da1db77f2a8dd1970b407b7610"
|
|
revision 2
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "f14e32d2cdfce897921c89c095434368d45dfb8a44bb1a1ec63d54cf6b09f4d4" => :catalina
|
|
sha256 "47877bef13fbc76962b1429bfc91ec976fdd9abe35d56ce2a6959887497d89aa" => :mojave
|
|
sha256 "e77b879de622561f9f508a33ec30f00ab290f13f087773f7391ac8c65f3eb174" => :high_sierra
|
|
end
|
|
|
|
depends_on "postgresql"
|
|
|
|
# Fix for postgresql 11 compatibility:
|
|
# https://github.com/arkhipov/temporal_tables/issues/38
|
|
patch do
|
|
url "https://github.com/mlt/temporal_tables/commit/24906c44.diff?full_index=1"
|
|
sha256 "9c20bde0bafb9cbf0fee9a4922134069e403c728660f6b9c0d6ee3ae7e48cdfc"
|
|
end
|
|
|
|
# Fix for postgresql 12 compatibility:
|
|
# https://github.com/arkhipov/temporal_tables/issues/47
|
|
patch do
|
|
url "https://github.com/mlt/temporal_tables/commit/a6772d195946f3a14e73b7d3aff200ab872753f4.patch?full_index=1"
|
|
sha256 "c15d7fa8a4ad7a047304c430e039776f6214a40bcc71f9a9ae627cb5cf73647e"
|
|
end
|
|
|
|
def install
|
|
ENV["PG_CONFIG"] = Formula["postgresql"].opt_bin/"pg_config"
|
|
|
|
# Use stage directory to prevent installing to pg_config-defined dirs,
|
|
# which would not be within this package's Cellar.
|
|
mkdir "stage"
|
|
system "make", "install", "DESTDIR=#{buildpath}/stage"
|
|
|
|
lib.install Dir["stage/**/lib/*"]
|
|
(share/"postgresql/extension").install Dir["stage/**/share/postgresql/extension/*"]
|
|
end
|
|
|
|
test do
|
|
pg_bin = Formula["postgresql"].opt_bin
|
|
pg_port = "55562"
|
|
system "#{pg_bin}/initdb", testpath/"test"
|
|
pid = fork { exec "#{pg_bin}/postgres", "-D", testpath/"test", "-p", pg_port }
|
|
|
|
begin
|
|
sleep 2
|
|
|
|
system "#{pg_bin}/createdb", "-p", pg_port, "test"
|
|
system "#{pg_bin}/psql", "-p", pg_port, "-d", "test", "--command", "CREATE EXTENSION temporal_tables;"
|
|
ensure
|
|
Process.kill 9, pid
|
|
Process.wait pid
|
|
end
|
|
end
|
|
end
|