class Kustomize < Formula desc "Template-free customization of Kubernetes YAML manifests" homepage "https://github.com/kubernetes-sigs/kustomize" url "https://github.com/kubernetes-sigs/kustomize.git", :tag => "kustomize/v3.5.3", :revision => "5ba90fe5ef1dc4599e359edd41d1d0e6373b247d" head "https://github.com/kubernetes-sigs/kustomize.git" bottle do cellar :any_skip_relocation sha256 "8de433297f8f42d0a9089526edadff9e7ae3da0bdb67089436aa3c650b54e99f" => :mojave sha256 "fe4599a80bde640958c1c05347f8e1d6d0d7c4003e7e778e01803d5dfcb97c3e" => :high_sierra end depends_on "go" => :build def install revision = Utils.popen_read("git", "rev-parse", "HEAD").strip cd "kustomize" do ldflags = %W[ -s -X sigs.k8s.io/kustomize/api/provenance.version=#{version} -X sigs.k8s.io/kustomize/api/provenance.gitCommit=#{revision} -X sigs.k8s.io/kustomize/api/provenance.buildDate=#{Time.now.iso8601} ] system "go", "build", "-ldflags", ldflags.join(" "), "-o", bin/"kustomize" end end test do assert_match version.to_s, shell_output("#{bin}/kustomize version") (testpath/"kustomization.yaml").write <<~EOS resources: - service.yaml patchesStrategicMerge: - patch.yaml EOS (testpath/"patch.yaml").write <<~EOS apiVersion: v1 kind: Service metadata: name: brew-test spec: selector: app: foo EOS (testpath/"service.yaml").write <<~EOS apiVersion: v1 kind: Service metadata: name: brew-test spec: type: LoadBalancer EOS output = shell_output("#{bin}/kustomize build #{testpath}") assert_match /type:\s+"?LoadBalancer"?/, output end end