homebrew-core/Formula/tile38.rb
2019-01-17 15:02:33 +08:00

75 lines
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.15.0.tar.gz"
sha256 "e747995b36e49abaaa45e39fc952b164dc1255055b6fca1578738f750d98575d"
head "https://github.com/tidwall/tile38.git"
bottle do
cellar :any_skip_relocation
sha256 "ebd25e48a47d2fa74bbf31553549f00f123571be60ef6a2308da4fb8bcb32bae" => :mojave
sha256 "f72ac6568728470fbc1f32f9a40c87921c319e5cb673de9625454b3771e4f90e" => :high_sierra
sha256 "8de9b7943b5c7f32e91767b3c029cf272af5f287dbe36ae739b5a393110baefc" => :sierra
end
depends_on "go" => :build
depends_on "godep" => :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
system bin/"tile38-cli", "-h"
end
end