class Meilisearch < Formula desc "Ultra relevant, instant and typo-tolerant full-text search API" homepage "https://docs.meilisearch.com/" url "https://github.com/meilisearch/MeiliSearch/archive/v0.14.0.tar.gz" sha256 "9cfaeef0cebaa3f0a6952122dc0f56183250461b76cca08453e3f87e2ac879db" license "MIT" bottle do cellar :any_skip_relocation sha256 "220a6ebc9062b478b3b5689ba1658a35ce59e9bc0bb8a1b561568d4e43ddb4c7" => :catalina sha256 "fd33a424061c4b939ed1023fdd37f35d7632f5227c0d66b8c727b64cc3f6fc8b" => :mojave sha256 "d35984a280149850d970c726291f0a5dad6e4f3b303020c5f2dca7e018dd1066" => :high_sierra end depends_on "rust" => :build def install cd "meilisearch-http" do system "cargo", "install", *std_cargo_args end end plist_options manual: "meilisearch" def plist <<~EOS KeepAlive Label #{plist_name} ProgramArguments #{opt_bin}/meilisearch --db-path #{var}/meilisearch/data.ms RunAtLoad WorkingDirectory #{var} StandardErrorPath #{var}/log/meilisearch.log StandardOutPath #{var}/log/meilisearch.log EOS end test do port = free_port fork { exec bin/"meilisearch", "--http-addr", "127.0.0.1:#{port}" } sleep(3) output = shell_output("curl -s 127.0.0.1:#{port}/version") assert_match version.to_s, output end end