homebrew-core/Formula/pilosa.rb

70 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.10.1.tar.gz"
sha256 "bc2aba9c63c105e51c206f0a1c76a0d6275b3952041690867be63b717bfa13c2"
bottle do
cellar :any_skip_relocation
sha256 "ff0c4497922945df6572d659e57eb74123e189aecb959c489acd5e55ef2ccbfb" => :high_sierra
sha256 "7c61b1f56dfbed5bfae5f5fcb18e4141e9623d554b502abccf6277f7109a2e07" => :sierra
sha256 "c34233da03a018f7c46a0c3fce19b8cb9b5d877f2a23e434e51f5955a7b0159d" => :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", "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"))
assert_match("<!DOCTYPE html>", shell_output("curl --user-agent NotCurl localhost:10101"))
ensure
Process.kill "TERM", server
Process.wait server
end
end
end