Skip to content

Instantly share code, notes, and snippets.

@a17levine
Created October 16, 2019 20:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save a17levine/1c86a094450026fcf9386e7f1a8c8e78 to your computer and use it in GitHub Desktop.
Save a17levine/1c86a094450026fcf9386e7f1a8c8e78 to your computer and use it in GitHub Desktop.
class KubernetesHelm < Formula
desc "The Kubernetes package manager"
homepage "https://helm.sh/"
url "https://github.com/helm/helm.git",
:tag => "v2.12.1",
:revision => "02a47c7249b1fc6d8fd3b94e6b4babf9d818144e"
head "https://github.com/helm/helm.git"
bottle do
cellar :any_skip_relocation
sha256 "91452b811fbd012b397d68428fd6b2161cb8d9993be4239312564a6d97b1006b" => :mojave
sha256 "5471be8bc0219781a6183c5f3d096aef9057af5fb997e7351e93e18692a4337a" => :high_sierra
sha256 "646643250d430206148c94a62af0d38c4c7d9c289e44bf742805f97c9208e0fd" => :sierra
end
depends_on "glide" => :build
depends_on "go" => :build
depends_on "mercurial" => :build
def install
ENV["GOPATH"] = buildpath
ENV["GLIDE_HOME"] = HOMEBREW_CACHE/"glide_home/#{name}"
ENV.prepend_create_path "PATH", buildpath/"bin"
arch = Hardware::CPU.is_64_bit? ? "amd64" : "x86"
ENV["TARGETS"] = "darwin/#{arch}"
dir = buildpath/"src/k8s.io/helm"
dir.install buildpath.children - [buildpath/".brew_home"]
cd dir do
system "make", "bootstrap"
system "make", "build"
bin.install "bin/helm"
bin.install "bin/tiller"
man1.install Dir["docs/man/man1/*"]
output = Utils.popen_read("SHELL=bash #{bin}/helm completion bash")
(bash_completion/"helm").write output
output = Utils.popen_read("SHELL=zsh #{bin}/helm completion zsh")
(zsh_completion/"_helm").write output
prefix.install_metafiles
end
end
test do
system "#{bin}/helm", "create", "foo"
assert File.directory? "#{testpath}/foo/charts"
version_output = shell_output("#{bin}/helm version --client 2>&1")
assert_match "GitTreeState:\"clean\"", version_output
assert_match stable.instance_variable_get(:@resource).instance_variable_get(:@specs)[:revision], version_output if build.stable?
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment