homebrew-core/Formula/linkerd.rb

54 lines
1.7 KiB
Ruby

class Linkerd < Formula
desc "Command-line utility to interact with linkerd"
homepage "https://linkerd.io"
url "https://github.com/linkerd/linkerd2.git",
tag: "stable-2.9.0",
revision: "2ff70d4c7da2af2dbe868d470bbacb9de0275607"
license "Apache-2.0"
livecheck do
url :stable
regex(/^stable[._-]v?(\d+(?:\.\d+)+)$/i)
end
bottle do
cellar :any_skip_relocation
sha256 "04ee15fee00dd50112bbfbb7527b927ea38c030df051c593b5fc33e9faaa1d0c" => :big_sur
sha256 "e17f51320f5c98673e91f206969cc041aa15fc8de2a6e8701f4ad579764ff240" => :catalina
sha256 "8ef3ca335235ac63ad208e1ef7abf26c8204e7e02bf02e56b1ea283a34e17798" => :mojave
sha256 "673eeea9576a8c2c913596824d9bd8034db602b2c30d7e918e3f12982cf47710" => :high_sierra
end
depends_on "go" => :build
def install
ENV["CI_FORCE_CLEAN"] = "1"
system "bin/build-cli-bin"
bin.install "target/cli/darwin/linkerd"
# Install bash completion
output = Utils.safe_popen_read("#{bin}/linkerd", "completion", "bash")
(bash_completion/"linkerd").write output
# Install zsh completion
output = Utils.safe_popen_read("#{bin}/linkerd", "completion", "zsh")
(zsh_completion/"linkerd").write output
prefix.install_metafiles
end
test do
run_output = shell_output("#{bin}/linkerd 2>&1")
assert_match "linkerd manages the Linkerd service mesh.", run_output
version_output = shell_output("#{bin}/linkerd version --client 2>&1")
assert_match "Client version: ", version_output
stable_resource = stable.instance_variable_get(:@resource)
assert_match stable_resource.instance_variable_get(:@specs)[:tag], version_output if build.stable?
system "#{bin}/linkerd", "install", "--ignore-cluster"
end
end