81 lines
2.5 KiB
Ruby
81 lines
2.5 KiB
Ruby
require "language/go"
|
|
|
|
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.6.0.tar.gz"
|
|
sha256 "6121066051ab55f266f2c891edcc66d449aa5786c8622f7f765015806ee6f84f"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "9d4ef7612d783786867d939e60fca53f52aac6ccd5edc3fa894368d32d6e5952" => :high_sierra
|
|
sha256 "856bcbf157d4374c259e20fd5b0afa7cc0faa0d340b2a8fc77a61cf4a7d820ad" => :sierra
|
|
sha256 "ddca7e8a0ace058776208d9f52332f760521fb5426362f57382e24a2e07cc3ab" => :el_capitan
|
|
sha256 "66c4f85b6f05e5873787a48a3665c0dcfe361dd2ab60ce3fdec44d9634bcac6d" => :yosemite
|
|
end
|
|
|
|
depends_on "go" => :build
|
|
depends_on "dep" => :build
|
|
|
|
go_resource "github.com/rakyll/statik" do
|
|
url "https://github.com/rakyll/statik.git",
|
|
:revision => "25d6cab4d68d2a9b7c5965aa381726dd5dd6d7b8"
|
|
end
|
|
|
|
def install
|
|
ENV["GOPATH"] = buildpath
|
|
ENV.prepend_path "PATH", "#{buildpath}/bin"
|
|
|
|
(buildpath/"src/github.com/pilosa/pilosa").install buildpath.children
|
|
Language::Go.stage_deps resources, buildpath/"src"
|
|
|
|
cd "src/github.com/rakyll/statik" do
|
|
system "go", "install"
|
|
end
|
|
cd "src/github.com/pilosa/pilosa" do
|
|
system "make", "generate-statik", "pilosa", "FLAGS=-o #{bin}/pilosa", "VERSION=#{version}"
|
|
end
|
|
end
|
|
|
|
plist_options :manual => "pilosa server"
|
|
|
|
def plist; <<-EOS.undent
|
|
<?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
|