2016-04-19 20:37:18 +00:00
|
|
|
class Citus < Formula
|
|
|
|
desc "PostgreSQL-based distributed RDBMS"
|
|
|
|
homepage "https://www.citusdata.com"
|
2016-09-06 21:45:03 +00:00
|
|
|
url "https://github.com/citusdata/citus/archive/v5.2.1.tar.gz"
|
|
|
|
sha256 "5014839eb7f20b1bd338e482340faedbd8162979992a6475d5dfea516dd0657c"
|
2016-09-20 12:24:31 +00:00
|
|
|
revision 1
|
2016-04-19 20:37:18 +00:00
|
|
|
|
|
|
|
head "https://github.com/citusdata/citus.git"
|
|
|
|
|
2016-04-19 23:35:54 +00:00
|
|
|
bottle do
|
2016-09-28 22:34:05 +00:00
|
|
|
sha256 "248d1bfa9264e8ae94b8a32bc473cfd8e0ef974c9d5f9ef43feda5cfdfba062d" => :sierra
|
|
|
|
sha256 "36359a493cc1ffc4abdf0908fb9760544fb2562b180d79eb3e5fbf2f08967659" => :el_capitan
|
|
|
|
sha256 "9a393831dad5bf98b08414d17f4779ca6759fbe77246f02e50d0b88d92cd3e11" => :yosemite
|
2016-04-19 23:35:54 +00:00
|
|
|
end
|
|
|
|
|
2016-04-19 20:37:18 +00:00
|
|
|
depends_on "postgresql"
|
2016-09-20 12:20:49 +00:00
|
|
|
depends_on "readline"
|
2016-04-19 20:37:18 +00:00
|
|
|
|
|
|
|
def install
|
|
|
|
ENV["PG_CONFIG"] = Formula["postgresql"].opt_bin/"pg_config"
|
|
|
|
|
|
|
|
system "./configure"
|
|
|
|
|
|
|
|
# workaround for https://github.com/Homebrew/homebrew/issues/49948
|
|
|
|
system "make", "libpq=-L#{Formula["postgresql"].opt_lib} -lpq"
|
|
|
|
|
|
|
|
# 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"
|
|
|
|
|
|
|
|
bin.install Dir["stage/**/bin/*"]
|
|
|
|
lib.install Dir["stage/**/lib/*"]
|
|
|
|
include.install Dir["stage/**/include/*"]
|
|
|
|
(share/"postgresql/extension").install Dir["stage/**/share/postgresql/extension/*"]
|
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
|
|
|
pg_bin = Formula["postgresql"].opt_bin
|
|
|
|
pg_port = "55561"
|
|
|
|
system "#{pg_bin}/initdb", testpath/"test"
|
|
|
|
pid = fork do
|
|
|
|
exec("#{pg_bin}/postgres",
|
|
|
|
"-D", testpath/"test",
|
|
|
|
"-c", "shared_preload_libraries=citus",
|
|
|
|
"-p", pg_port)
|
|
|
|
end
|
|
|
|
|
|
|
|
begin
|
|
|
|
sleep 2
|
|
|
|
|
|
|
|
count_workers_query = "SELECT COUNT(*) FROM master_get_active_worker_nodes();"
|
|
|
|
|
|
|
|
system "#{pg_bin}/createdb", "-p", pg_port, "test"
|
|
|
|
system "#{pg_bin}/psql", "-p", pg_port, "-d", "test", "--command", "CREATE EXTENSION citus;"
|
|
|
|
|
|
|
|
assert_equal "0", shell_output("#{pg_bin}/psql -p #{pg_port} -d test -Atc" \
|
|
|
|
"'#{count_workers_query}'").strip
|
|
|
|
ensure
|
|
|
|
Process.kill 9, pid
|
|
|
|
Process.wait pid
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|