homebrew-tap/Formula/aio.rb

35 lines
1.2 KiB
Ruby

# Homebrew formula for aio, the Interweb Mozambique All in One AI command.
# The package is the aio-<version>.tgz asset of the api-cli release on git.interweb.co.mz.
class Aio < Formula
desc "Command-line client for Interweb Mozambique All in One AI"
homepage "https://docs.interweb.co.mz/cli/"
url "https://git.interweb.co.mz/interweb-mz/api-cli/releases/download/v1.0.1/aio-1.0.1.tgz"
sha256 "b8a1167decdb99f1fed66b1b04f97ba6edcdb53ffcfba5542b57566f2f4884ac"
license "MIT"
depends_on "node"
def install
# aio is a single file with no dependencies: keep it in libexec and
# start it with the Node.js from Homebrew, whatever node is on PATH.
libexec.install "bin/aio.js"
(bin/"aio").write <<~SH
#!/bin/sh
exec "#{Formula["node"].opt_bin}/node" "#{libexec}/aio.js" "$@"
SH
chmod 0755, bin/"aio"
end
def caveats
<<~EOS
Create an API key with the ai:read and ai:write permissions in the
API Center (https://www.meu.interweb.co.mz/api-center.php), then run:
aio auth login
Or set the key in the AIO_API_KEY environment variable.
EOS
end
test do
assert_match "aio #{version}", shell_output("#{bin}/aio --version")
end
end