homebrew-core/Formula/octant.rb
2019-10-19 13:08:34 +02:00

52 lines
1.7 KiB
Ruby

class Octant < Formula
desc "Kubernetes introspection tool for developers"
homepage "https://github.com/vmware/octant"
url "https://github.com/vmware/octant.git",
:tag => "v0.8.0",
:revision => "e37e7f6c6c797ef215fdbeedb91c709c88193522"
head "https://github.com/vmware/octant.git"
bottle do
cellar :any_skip_relocation
sha256 "8769013488fe3dfbef05505433ac47efdfacd9c190e5da616a74bb643b9a86c1" => :catalina
sha256 "a9984601336d64877fa6430087e4ba47f52482c8687915af11d2610ed478b007" => :mojave
sha256 "807f721c89c7222a8f1c514fe061d58155bfeea40d619b89131cdfa7bac19115" => :high_sierra
end
depends_on "go" => :build
depends_on "node@10" => :build
depends_on "protoc-gen-go" => :build
def install
ENV["GOPATH"] = buildpath
ENV["GOFLAGS"] = "-mod=vendor"
dir = buildpath/"src/github.com/vmware/octant"
dir.install buildpath.children
cd "src/github.com/vmware/octant" do
system "make", "go-install"
ENV.prepend_path "PATH", buildpath/"bin"
system "make", "web-build"
system "make", "generate"
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