61 lines
1.9 KiB
Ruby
61 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.15.1.tar.gz"
|
|
sha256 "d2c2fba9efb7a0c6c2706a2ec1ccd19cb8b3dc0441cb35c71d851d60917f5091"
|
|
head "https://github.com/nats-io/nats-streaming-server.git"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "8d3028ede1f4ee7dbcd4be5e63cc5594f7468184093c5d34aee5dc9da226fed0" => :mojave
|
|
sha256 "47146bb59c7026f31ad02fd37d6fcebe5de1810d6ee31466184aeb3a4eea33a1" => :high_sierra
|
|
sha256 "be1ca60bdeb4a74766bb2e2122cb6c2a87f13aa9cdefba9169917faec44b1d49" => :sierra
|
|
end
|
|
|
|
depends_on "go" => :build
|
|
|
|
def install
|
|
ENV["GOPATH"] = buildpath
|
|
ENV["GO111MODULE"] = "off"
|
|
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
|
|
<?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_predicate testpath/"log", :exist?
|
|
assert_match version.to_s, File.read(testpath/"log")
|
|
ensure
|
|
Process.kill "SIGINT", pid
|
|
Process.wait pid
|
|
end
|
|
end
|
|
end
|