homebrew-core/Formula/calicoctl.rb
2019-05-10 09:03:18 +02:00

36 lines
1.4 KiB
Ruby

class Calicoctl < Formula
desc "Calico CLI tool"
homepage "https://www.projectcalico.org"
url "https://github.com/projectcalico/calicoctl.git",
:tag => "v3.5.4",
:revision => "8b6cf489c7c9f2e7d87ac82a1a063624e2ba0690"
bottle do
cellar :any_skip_relocation
sha256 "014673f85d3b4ee742d8ce4116b66fb445c179d44ff18a19a3716ac114ef4600" => :mojave
sha256 "32db6c261344993905ca022aa83f38002057dd8e53c6240c683519e5ebe1b471" => :high_sierra
sha256 "80d7c7adf64248b3dfc4e0f7f1ee632f1b20ba2c2aac118368f52602d0b42e79" => :sierra
end
depends_on "glide" => :build
depends_on "go" => :build
def install
ENV["GOPATH"] = buildpath
ENV["GLIDE_HOME"] = HOMEBREW_CACHE/"glide_home/#{name}"
dir = buildpath/"src/github.com/projectcalico/calicoctl"
dir.install buildpath.children
cd dir do
system "glide", "install", "-strip-vendor"
commands = "github.com/projectcalico/calicoctl/calicoctl/commands"
ldflags = "-X #{commands}.VERSION=#{stable.specs[:tag]} -X #{commands}.GIT_REVISION=#{stable.specs[:revision][0, 8]} -s -w"
system "go", "build", "-v", "-o", "dist/calicoctl-darwin-amd64", "-ldflags", ldflags, "./calicoctl/calicoctl.go"
bin.install "dist/calicoctl-darwin-amd64" => "calicoctl"
prefix.install_metafiles
end
end
test do
assert_match version.to_s, shell_output("#{bin}/calicoctl version", 1)
end
end