class Tile38 < Formula desc "In-memory geolocation data store, spatial index, and realtime geofence" homepage "http://tile38.com" url "https://github.com/tidwall/tile38/archive/1.12.0.tar.gz" sha256 "ca054d40109ff970fccd29efc425fc249b1824bf9dccfdc50e461d9e980ba014" head "https://github.com/tidwall/tile38.git" bottle do cellar :any_skip_relocation sha256 "ed9a3f73fc53e1b5b0127d7b372cbf7f2b3ceaed40b92b3f7a07586d03d6fad5" => :high_sierra sha256 "b0135a660705b6f7ed12d3dccd87f6416d9171cc577c574658f43a22502c4a24" => :sierra sha256 "4884028f192a9825bb55bcfdd5b8f779512eca4d4377475ee02bd85fcd10b288" => :el_capitan 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 plist_options :manual => "tile38-server -d #{HOMEBREW_PREFIX}/var/tile38/data" def plist; <<~EOS KeepAlive SuccessfulExit Label #{plist_name} ProgramArguments #{opt_bin}/tile38-server -d #{datadir} RunAtLoad WorkingDirectory #{var} StandardErrorPath #{var}/log/tile38.log StandardOutPath #{var}/log/tile38.log EOS end def caveats; <<~EOS To connect: tile38-cli EOS end test do system bin/"tile38-cli", "-h" end end