class Pilosa < Formula desc "Distributed bitmap index that queries across data sets" homepage "https://www.pilosa.com" url "https://github.com/pilosa/pilosa/archive/v0.8.7.tar.gz" sha256 "c7a5e1206f8a792fa5f885427afc68f040f0dab3693afb3f281637738dbf628c" bottle do cellar :any_skip_relocation sha256 "a34142566a4fc1ba6ae98a19dc87b4163e63aa3165eee42bff3562c0767c3548" => :high_sierra sha256 "657c3d0bbb13a8b3ff826a01063d8efc1a8c9eac352c6b2ed2451dab2f200c13" => :sierra sha256 "defd55c78277acb3b738902e7d04c785e5317d5b0d2591f79e29aec85c2db858" => :el_capitan end depends_on "dep" => :build depends_on "go" => :build depends_on "go-statik" => :build def install ENV["GOPATH"] = buildpath (buildpath/"src/github.com/pilosa/pilosa").install buildpath.children cd "src/github.com/pilosa/pilosa" do system "make", "generate-statik", "pilosa", "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")) assert_match("", shell_output("curl --user-agent NotCurl localhost:10101")) ensure Process.kill "TERM", server Process.wait server end end end