Skip to content

Commit

Permalink
postgrest 0.3.0.1
Browse files Browse the repository at this point in the history
Make postgrest test compatible with ruby 1.8

Remove call to Process.spawn, and replace with fork, exec, and
Process.detach.

Closes Homebrew/legacy-homebrew#46773.

Signed-off-by: Dominyk Tiller <dominyktiller@gmail.com>
  • Loading branch information
xDAGRONx authored and DomT4 committed Dec 10, 2015
1 parent eee8f1c commit 902fdfd
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions Formula/postgrest.rb
Expand Up @@ -6,8 +6,8 @@ class Postgrest < Formula

desc "Serves a fully RESTful API from any existing PostgreSQL database."
homepage "https://github.com/begriffs/postgrest"
url "https://github.com/begriffs/postgrest/archive/v0.2.12.0.tar.gz"
sha256 "9f7277720b947b06eb53ac0a54686eb437253d417695bc756220e703532a725a"
url "https://github.com/begriffs/postgrest/archive/v0.3.0.1.tar.gz"
sha256 "d2e92795a480e3a06d625905fb20bce30e5b86af6525cdec809e6a88200efab8"

bottle do
sha256 "fc88d2190b524fde39a99855c134e5b5ed68499b5533566c097dd495f9fcfa47" => :el_capitan
Expand Down Expand Up @@ -39,16 +39,21 @@ def install

begin
system "#{pg_bin}/createdb", "-w", "-p", pg_port, "-U", pg_user, test_db
pid = Process.spawn("postgrest -d #{test_db} -P #{pg_port} " \
"-U #{pg_user} -a #{pg_user} -p 55560",
:out => "/dev/null", :err => "/dev/null")
pid = fork do
exec "postgrest", "postgres://#{pg_user}@localhost:#{pg_port}/#{test_db}",
"-a", pg_user, "-p", "55560"
end
Process.detach(pid)
sleep(5) # Wait for the server to start
response = Net::HTTP.get(URI("http://localhost:55560"))
assert_equal "[]", response
ensure
Process.kill("TERM", pid) if pid
system "#{pg_bin}/pg_ctl", "-D", testpath/test_db, "stop",
"-s", "-m", "fast"
begin
Process.kill("TERM", pid) if pid
ensure
system "#{pg_bin}/pg_ctl", "-D", testpath/test_db, "stop",
"-s", "-m", "fast"
end
end
end
end

0 comments on commit 902fdfd

Please sign in to comment.