homebrew-core/Formula/linkerd.rb
2019-03-03 18:15:27 +01:00

52 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.2.1",
:revision => "5e47cb150a33150e5aeddc6672d8a64701a970de"
bottle do
cellar :any_skip_relocation
sha256 "ee40528c700f1f7de26ee8d85d562d8bf25f4c604d1965384321335b5be515f5" => :mojave
sha256 "88e7fc735f3edc8899a10dda7fa3e928153588ed8becec1dd9d6fca4073e6a9e" => :high_sierra
sha256 "48a5ed85ebe67954bf2467ff5ac4a3f217e1416cb753c69846fd88b66e5e8c13" => :sierra
end
depends_on "go" => :build
def install
ENV["GOPATH"] = buildpath
ENV["CI_FORCE_CLEAN"] = "1"
srcpath = buildpath/"src/github.com/linkerd/linkerd2"
srcpath.install buildpath.children - [buildpath/".brew_home"]
cd srcpath do
system "bin/build-cli-bin"
bin.install "target/cli/darwin/linkerd"
# Install bash completion
output = Utils.popen_read("#{bin}/linkerd completion bash")
(bash_completion/"linkerd").write output
# Install zsh completion
output = Utils.popen_read("#{bin}/linkerd completion zsh")
(zsh_completion/"linkerd").write output
prefix.install_metafiles
end
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"
end
end