43 lines
1.7 KiB
Ruby
43 lines
1.7 KiB
Ruby
class Kubebuilder < Formula
|
|
desc "SDK for building Kubernetes APIs using CRDs"
|
|
homepage "https://github.com/kubernetes-sigs/kubebuilder"
|
|
url "https://github.com/kubernetes-sigs/kubebuilder.git",
|
|
tag: "v3.0.0",
|
|
revision: "533874b302e9bf94cd7105831f8a543458752973"
|
|
license "Apache-2.0"
|
|
head "https://github.com/kubernetes-sigs/kubebuilder.git"
|
|
|
|
bottle do
|
|
sha256 cellar: :any_skip_relocation, arm64_big_sur: "55348fbd6436d4d042b99b4e7cb97f854c9152a70c4601a1dce2bf6991aef14f"
|
|
sha256 cellar: :any_skip_relocation, big_sur: "b4da6ec95295019b60db8f1efb01420f135761e773922e5064b5fd062b3cc4e2"
|
|
sha256 cellar: :any_skip_relocation, catalina: "f054ded054d4bd66b8c3fd02f52478794dfb71b4e2060598015c8788a1718bbc"
|
|
sha256 cellar: :any_skip_relocation, mojave: "3cdd592baf0632d66c5795036c65c994790b9278f6b74d4222e492dbb1ae1bf9"
|
|
end
|
|
|
|
depends_on "git-lfs" => :build
|
|
depends_on "go"
|
|
|
|
def install
|
|
goos = Utils.safe_popen_read("#{Formula["go"].bin}/go", "env", "GOOS").chomp
|
|
goarch = Utils.safe_popen_read("#{Formula["go"].bin}/go", "env", "GOARCH").chomp
|
|
ldflags = %W[
|
|
-X main.kubeBuilderVersion=#{version}
|
|
-X main.goos=#{goos}
|
|
-X main.goarch=#{goarch}
|
|
-X main.gitCommit=#{Utils.git_head}
|
|
-X main.buildDate=#{Time.now.iso8601}
|
|
]
|
|
system "go", "build", *std_go_args(ldflags: ldflags.join(" ")), "./cmd"
|
|
end
|
|
|
|
test do
|
|
assert_match "KubeBuilderVersion:\"#{version}\"", shell_output("#{bin}/kubebuilder version 2>&1")
|
|
mkdir "test" do
|
|
system "go", "mod", "init", "example.com"
|
|
system "#{bin}/kubebuilder", "init",
|
|
"--plugins", "go/v3", "--project-version", "3",
|
|
"--skip-go-version-check"
|
|
end
|
|
end
|
|
end
|