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.1.tar.gz"
sha256 "7310cec87fb6c369bf63e97560c05a6d326b7e840a0958639b71687dde156f8b"
license "MIT"
bottle do
cellar :any_skip_relocation
sha256 "db8b2f5d64c940949a264a601655760c51323b681697d622fa31695de2944751" => :catalina
sha256 "a3ea3148f9f047081de0ab6a21382d3ac59de3b6a72b2d6dc883124475a9c251" => :mojave
sha256 "206e2e3031a58dd886817e136cf6e0ce52128eec5f1837eba64d54a75733907e" => :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