class Pilosa < Formula desc "Distributed bitmap index that queries across data sets" homepage "https://www.pilosa.com" url "https://github.com/pilosa/pilosa/archive/v1.3.1.tar.gz" sha256 "5e0040b7605cae3ebf2b617d472e7c104ad026982ba52e83f8b0593b32b6fa05" bottle do cellar :any_skip_relocation sha256 "36b8c8e39db4de4e18698e139d709166ef5ff09ef64c0e007f63b31bf11ce14f" => :mojave sha256 "45ed3cc1e4ce0d1d30b4492bf1f997eb21f31c074ef4d59ac46728d0563e23bc" => :high_sierra sha256 "32c6572b34fe9c85b9dfa26da8dd84b26f811b3cd67d9fcf0be64f0cccbc9bb7" => :sierra end depends_on "go" => :build def install ENV["GOPATH"] = buildpath ENV["GO111MODULE"] = "on" (buildpath/"src/github.com/pilosa/pilosa").install buildpath.children cd "src/github.com/pilosa/pilosa" do system "make", "build", "FLAGS=-o #{bin}/pilosa", "VERSION=v#{version}" prefix.install_metafiles end end plist_options :manual => "pilosa server" def plist; <<~EOS Label #{plist_name} ProgramArguments #{opt_bin}/pilosa server RunAtLoad KeepAlive SuccessfulExit WorkingDirectory #{var} EOS end test do begin server = fork do exec "#{bin}/pilosa", "server" end sleep 0.5 assert_match("Welcome. Pilosa is running.", shell_output("curl localhost:10101")) ensure Process.kill "TERM", server Process.wait server end end end