58 lines
2.0 KiB
Ruby
58 lines
2.0 KiB
Ruby
# Template used by update-homebrew-tap.sh. Placeholder strings are replaced at
|
|
# release time before this formula is pushed to kdlbs/homebrew-kandev.
|
|
class Kandev < Formula
|
|
desc "Manage tasks, orchestrate agents, review changes, and ship value"
|
|
homepage "https://github.com/kdlbs/kandev"
|
|
# Conditional asset names end in x64/arm64; without this, Homebrew uses version 64.
|
|
version "__VERSION__"
|
|
license "AGPL-3.0-only"
|
|
|
|
on_macos do
|
|
if Hardware::CPU.arm?
|
|
url "__GITHUB_BASE__/kandev-macos-arm64.tar.gz"
|
|
sha256 "__SHA_MACOS_ARM64__"
|
|
else
|
|
url "__GITHUB_BASE__/kandev-macos-x64.tar.gz"
|
|
sha256 "__SHA_MACOS_X64__"
|
|
end
|
|
end
|
|
|
|
on_linux do
|
|
if Hardware::CPU.arm?
|
|
url "__GITHUB_BASE__/kandev-linux-arm64.tar.gz"
|
|
sha256 "__SHA_LINUX_ARM64__"
|
|
else
|
|
url "__GITHUB_BASE__/kandev-linux-x64.tar.gz"
|
|
sha256 "__SHA_LINUX_X64__"
|
|
end
|
|
end
|
|
|
|
def install
|
|
libexec.install Dir["*"]
|
|
# Create a stable wrapper at $HOMEBREW_PREFIX/bin/kandev that points at the
|
|
# native launcher in the Cellar and sets the bundle/version env it uses to
|
|
# find bin/.
|
|
(bin/"kandev").write_env_script libexec/"bin/kandev",
|
|
KANDEV_BUNDLE_DIR: libexec.to_s,
|
|
KANDEV_VERSION: version.to_s
|
|
end
|
|
|
|
test do
|
|
assert_equal "v#{version}", shell_output("#{bin}/kandev --version").strip
|
|
|
|
ENV["KANDEV_HOME_DIR"] = testpath.to_s
|
|
ENV["KANDEV_DATABASE_PATH"] = (testpath/"kandev.db").to_s
|
|
ENV["KANDEV_SERVER_HOST"] = "127.0.0.1"
|
|
port = free_port
|
|
pid = spawn bin/"kandev", "--headless", "--port", port.to_s
|
|
health_url = "http://127.0.0.1:#{port}/health"
|
|
curl = "curl --silent --show-error --fail --retry 30 --retry-connrefused --retry-delay 1"
|
|
health = shell_output("#{curl} #{health_url}")
|
|
assert_match '"status":"ok"', health
|
|
assert_match "<title>Kandev</title>", shell_output("#{curl} http://127.0.0.1:#{port}/")
|
|
ensure
|
|
Process.kill("TERM", pid) if pid
|
|
Process.wait(pid) if pid
|
|
end
|
|
end
|