54 lines
1.8 KiB
Ruby
54 lines
1.8 KiB
Ruby
class Octant < Formula
|
|
desc "Kubernetes introspection tool for developers"
|
|
homepage "https://octant.dev"
|
|
url "https://github.com/vmware-tanzu/octant.git",
|
|
:tag => "v0.10.2",
|
|
:revision => "438ce3d52088c1e3e15aaf9817ba71e3c85255f5"
|
|
head "https://github.com/vmware-tanzu/octant.git"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "72bf55dc7fa6d63d6238ee3c39323db780e6d3d17fd08894cc6c47a780c25c5f" => :catalina
|
|
sha256 "1a75661c1bb9feaee2ee0fd38935cfcc0e1902a094b989c4b8bd19021152417b" => :mojave
|
|
sha256 "1aa20269795bef2884d76beee0a53f5d86411fa352b7747c7e9ddb2ac819b339" => :high_sierra
|
|
end
|
|
|
|
depends_on "go" => :build
|
|
depends_on "node" => :build
|
|
|
|
def install
|
|
ENV["GOPATH"] = buildpath
|
|
ENV["GOFLAGS"] = "-mod=vendor"
|
|
|
|
ENV.append_path "PATH", HOMEBREW_PREFIX/"bin"
|
|
|
|
dir = buildpath/"src/github.com/vmware-tanzu/octant"
|
|
dir.install buildpath.children
|
|
|
|
cd "src/github.com/vmware-tanzu/octant" do
|
|
system "go", "run", "build.go", "go-install"
|
|
ENV.prepend_path "PATH", buildpath/"bin"
|
|
|
|
system "go", "generate", "./pkg/icon"
|
|
system "go", "run", "build.go", "web-build"
|
|
|
|
commit = Utils.popen_read("git rev-parse HEAD").chomp
|
|
build_time = Utils.popen_read("date -u +'%Y-%m-%dT%H:%M:%SZ' 2> /dev/null").chomp
|
|
ldflags = ["-X \"main.version=#{version}\"",
|
|
"-X \"main.gitCommit=#{commit}\"",
|
|
"-X \"main.buildTime=#{build_time}\""]
|
|
|
|
system "go", "build", "-o", bin/"octant", "-ldflags", ldflags.join(" "),
|
|
"-v", "./cmd/octant"
|
|
end
|
|
end
|
|
|
|
test do
|
|
kubeconfig = testpath/"config"
|
|
output = shell_output("#{bin}/octant --kubeconfig #{kubeconfig} 2>&1", 1)
|
|
assert_match "failed to init cluster client", output
|
|
|
|
assert_match version.to_s, shell_output("#{bin}/octant version")
|
|
end
|
|
end
|