homebrew-core/Formula/calicoctl.rb
2019-02-26 22:57:26 +01: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.2",
:revision => "0f3d4af3c263371ed405099b8ebc6dd418822214"
bottle do
cellar :any_skip_relocation
sha256 "06d6119c667fb18c510ba1650ef2dad63ebc36730b414d58869296dc24e68746" => :mojave
sha256 "7a3cd812d7737d3396abc7e8acb854776ecdc4be7ede2ebc8333a64faaffddbb" => :high_sierra
sha256 "5a8a43f715c672d57dff649e214b568647297b5ce04ab8aa11ebd1619a08fc09" => :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