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.5.tar.gz" sha256 "5090811adda9857285f4e0e4ea2cf8e2dd66730fc8b2d5642d3e30bf4ba4731f" bottle do cellar :any_skip_relocation sha256 "7f6ec17d560337d139123507c2ae67ecba76e21bd2f510be77ca2221465f4a1a" => :high_sierra sha256 "69329b7dc35640530c9f177aee9f21b7bbaf4c98e648b8ad3be9771066e6092e" => :sierra sha256 "cbcf7f0754f0334c9674540e5dc7f79e609ea2cced4d89a0ba72f5fd4c2fe193" => :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