84 lines
2.2 KiB
Ruby
84 lines
2.2 KiB
Ruby
class Tile38 < Formula
|
|
desc "In-memory geolocation data store, spatial index, and realtime geofence"
|
|
homepage "https://tile38.com/"
|
|
url "https://github.com/tidwall/tile38/archive/1.17.1.tar.gz"
|
|
sha256 "a621091ddca8e07d2f1d1cb4d2a4898d59b5c1abb32767d9d573aa3249f23004"
|
|
head "https://github.com/tidwall/tile38.git"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "b2f04f1d5892c67b732c7e1b72222dbce04c4c17cc5e9b4f9e588640fe841e38" => :mojave
|
|
sha256 "c6a6c1adf6ff179dcdb9ad6fc28ab773d880fc081b26b3ee3c07c6278b2c96d7" => :high_sierra
|
|
sha256 "91d6657818cc72d7be3a778ef59325c271a795419ecf631031de81ba370d9767" => :sierra
|
|
end
|
|
|
|
depends_on "go" => :build
|
|
|
|
def datadir
|
|
var/"tile38/data"
|
|
end
|
|
|
|
def install
|
|
ENV["GOPATH"] = buildpath
|
|
system "make"
|
|
|
|
bin.install "tile38-cli", "tile38-server"
|
|
end
|
|
|
|
def post_install
|
|
# Make sure the data directory exists
|
|
datadir.mkpath
|
|
end
|
|
|
|
def caveats; <<~EOS
|
|
To connect: tile38-cli
|
|
EOS
|
|
end
|
|
|
|
plist_options :manual => "tile38-server -d #{HOMEBREW_PREFIX}/var/tile38/data"
|
|
|
|
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>KeepAlive</key>
|
|
<dict>
|
|
<key>SuccessfulExit</key>
|
|
<false/>
|
|
</dict>
|
|
<key>Label</key>
|
|
<string>#{plist_name}</string>
|
|
<key>ProgramArguments</key>
|
|
<array>
|
|
<string>#{opt_bin}/tile38-server</string>
|
|
<string>-d</string>
|
|
<string>#{datadir}</string>
|
|
</array>
|
|
<key>RunAtLoad</key>
|
|
<true/>
|
|
<key>WorkingDirectory</key>
|
|
<string>#{var}</string>
|
|
<key>StandardErrorPath</key>
|
|
<string>#{var}/log/tile38.log</string>
|
|
<key>StandardOutPath</key>
|
|
<string>#{var}/log/tile38.log</string>
|
|
</dict>
|
|
</plist>
|
|
EOS
|
|
end
|
|
|
|
test do
|
|
begin
|
|
pid = fork do
|
|
exec "#{bin}/tile38-server", "-q"
|
|
end
|
|
sleep 2
|
|
json_output = shell_output("#{bin}/tile38-cli server")
|
|
tile38_server = JSON.parse(json_output)
|
|
assert_equal tile38_server["ok"], true
|
|
ensure
|
|
Process.kill("HUP", pid)
|
|
end
|
|
end
|
|
end
|