homebrew-core/Formula/pilosa.rb
2019-05-18 10:59:53 +02:00

67 lines
1.9 KiB
Ruby

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
<?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}/pilosa</string>
<string>server</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<dict>
<key>SuccessfulExit</key>
<false/>
</dict>
<key>WorkingDirectory</key>
<string>#{var}</string>
</dict>
</plist>
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