47 lines
1.7 KiB
Ruby
47 lines
1.7 KiB
Ruby
class Velero < Formula
|
|
desc "Disaster recovery for Kubernetes resources and persistent volumes"
|
|
homepage "https://github.com/vmware-tanzu/velero"
|
|
url "https://github.com/vmware-tanzu/velero/archive/v1.3.1.tar.gz"
|
|
sha256 "ff49dda812137befe0e33c130a06862d07bf5c62268ea23b0f5092d0ea144858"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "6d1dea3e2e1dd72480f81bb001e203bc0f68bc74aa522c6bf64cfd8c62d09f31" => :catalina
|
|
sha256 "8593735a54b607680be528a35b0fc35475e5396bf86d19e0ec72907a749f50ff" => :mojave
|
|
sha256 "1b4982f30e72daea127667c86080679bfa1c8b499afd90762ba5dc758d116eb7" => :high_sierra
|
|
end
|
|
|
|
depends_on "go" => :build
|
|
|
|
def install
|
|
ENV["GOPATH"] = buildpath
|
|
dir = buildpath/"src/github.com/vmware-tanzu/velero"
|
|
dir.install buildpath.children - [buildpath/".brew_home"]
|
|
|
|
cd dir do
|
|
system "go", "build", "-o", bin/"velero", "-installsuffix", "static",
|
|
"-ldflags",
|
|
"-X github.com/vmware-tanzu/velero/pkg/buildinfo.Version=v#{version}",
|
|
"./cmd/velero"
|
|
|
|
# Install bash completion
|
|
output = Utils.popen_read("#{bin}/velero completion bash")
|
|
(bash_completion/"velero").write output
|
|
|
|
# Install zsh completion
|
|
output = Utils.popen_read("#{bin}/velero completion zsh")
|
|
(zsh_completion/"_velero").write output
|
|
|
|
prefix.install_metafiles
|
|
end
|
|
end
|
|
|
|
test do
|
|
output = shell_output("#{bin}/velero 2>&1")
|
|
assert_match "Velero is a tool for managing disaster recovery", output
|
|
assert_match "Version: v#{version}", shell_output("#{bin}/velero version --client-only 2>&1")
|
|
system bin/"velero", "client", "config", "set", "TEST=value"
|
|
assert_match "value", shell_output("#{bin}/velero client config get 2>&1")
|
|
end
|
|
end
|