homebrew-core/Formula/pilosa.rb
2018-02-20 18:19:45 +10:00

69 lines
2.1 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/v0.8.8.tar.gz"
sha256 "d430cb86f99595e26817fcff1441af815055485ef213a91c54af59181182dfd8"
bottle do
cellar :any_skip_relocation
sha256 "b53e5982845292ea5a836866bb38356a1ef78b302f26ed687c46355bedfe1178" => :high_sierra
sha256 "cffc67a81a17cf30cfd37ad219593703806af37c9c000f8ee183f4fba4c80c80" => :sierra
sha256 "b803765ae2cfb19131293a09de26f4b18d3b7033fa7d4f52262b8f297471a2e7" => :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
<?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"))
assert_match("<!DOCTYPE html>", shell_output("curl --user-agent NotCurl localhost:10101"))
ensure
Process.kill "TERM", server
Process.wait server
end
end
end