51 lines
1.6 KiB
Ruby
51 lines
1.6 KiB
Ruby
class Pgroonga < Formula
|
|
desc "PostgreSQL plugin to use Groonga as index"
|
|
homepage "https://pgroonga.github.io/"
|
|
url "https://packages.groonga.org/source/pgroonga/pgroonga-2.2.6.tar.gz"
|
|
sha256 "799bb56468d66e3e736759f1e19c0deb8368e07d354932f06979302309efd42a"
|
|
|
|
livecheck do
|
|
url "https://packages.groonga.org/source/pgroonga/"
|
|
regex(/href=.*?pgroonga[._-]v?(\d+(?:\.\d+)+)\.t/i)
|
|
end
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "9fd0decbb8035c8b86a85a9a18c69cc18ca80343aa79142437ebc085d2e92c0c" => :catalina
|
|
sha256 "9a7b21ee071a28ce41b2407509801cdf526a4752f84a14e4a5931eec18f32cd2" => :mojave
|
|
sha256 "83504f44a4635b8e70d1505b315895bed3a94d2925c968f42f481a23afb1ab10" => :high_sierra
|
|
end
|
|
|
|
depends_on "pkg-config" => :build
|
|
depends_on "groonga"
|
|
depends_on "postgresql"
|
|
|
|
def install
|
|
system "make"
|
|
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
|
|
return if ENV["CI"]
|
|
|
|
pg_bin = Formula["postgresql"].opt_bin
|
|
pg_port = "55561"
|
|
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
|
|
system "#{pg_bin}/psql", "-p", pg_port, "--command", "CREATE DATABASE test;"
|
|
system "#{pg_bin}/psql", "-p", pg_port, "-d", "test", "--command", "CREATE EXTENSION pgroonga;"
|
|
ensure
|
|
Process.kill 9, pid
|
|
Process.wait pid
|
|
end
|
|
end
|
|
end
|