homebrew-core/Formula/meilisearch.rb

62 lines
1.9 KiB
Ruby

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
<?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>
<false/>
<key>Label</key>
<string>#{plist_name}</string>
<key>ProgramArguments</key>
<array>
<string>#{opt_bin}/meilisearch</string>
<string>--db-path</string>
<string>#{var}/meilisearch/data.ms</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>WorkingDirectory</key>
<string>#{var}</string>
<key>StandardErrorPath</key>
<string>#{var}/log/meilisearch.log</string>
<key>StandardOutPath</key>
<string>#{var}/log/meilisearch.log</string>
</dict>
</plist>
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