59 lines
1.9 KiB
Ruby
59 lines
1.9 KiB
Ruby
class NatsStreamingServer < Formula
|
|
desc "Lightweight cloud messaging system"
|
|
homepage "https://nats.io"
|
|
url "https://github.com/nats-io/nats-streaming-server/archive/v0.3.8.tar.gz"
|
|
sha256 "3106fc9f6f14bf896c8ca216ea85edbb232ddbd4ebfb8f3a276520f26000a9f5"
|
|
head "https://github.com/nats-io/nats-streaming-server.git"
|
|
|
|
bottle do
|
|
sha256 "2fc80380e9368b1c7f4261b53515bddbea762f55d28d8a443e08b612b77a787e" => :sierra
|
|
sha256 "6669019510920f160a13dec8a471a49106e033283537f8d1f5a4adb52b637324" => :el_capitan
|
|
sha256 "9b2bc452b1607a55a577952ab836514e7d96e76db1fe095f4efeb4450ae43c90" => :yosemite
|
|
end
|
|
|
|
depends_on "go" => :build
|
|
|
|
def install
|
|
ENV["GOPATH"] = buildpath
|
|
mkdir_p "src/github.com/nats-io"
|
|
ln_s buildpath, "src/github.com/nats-io/nats-streaming-server"
|
|
buildfile = buildpath/"src/github.com/nats-io/nats-streaming-server/nats-streaming-server.go"
|
|
system "go", "build", "-v", "-o", bin/"nats-streaming-server", buildfile
|
|
end
|
|
|
|
plist_options :manual => "nats-streaming-server"
|
|
|
|
def plist; <<-EOS.undent
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
<plist version="1.0">
|
|
<dict>
|
|
<key>Label</key>
|
|
<string>#{plist_name}</string>
|
|
<key>ProgramArguments</key>
|
|
<array>
|
|
<string>#{opt_bin}/nats-streaming-server</string>
|
|
</array>
|
|
<key>RunAtLoad</key>
|
|
<true/>
|
|
</dict>
|
|
</plist>
|
|
EOS
|
|
end
|
|
|
|
test do
|
|
pid = fork do
|
|
exec "#{bin}/nats-streaming-server --port=8085 --pid=#{testpath}/pid --log=#{testpath}/log"
|
|
end
|
|
sleep 3
|
|
|
|
begin
|
|
assert_match "INFO", shell_output("curl localhost:8085")
|
|
assert File.exist?(testpath/"log")
|
|
assert_match version.to_s, File.read(testpath/"log")
|
|
ensure
|
|
Process.kill "SIGINT", pid
|
|
Process.wait pid
|
|
end
|
|
end
|
|
end
|