From 4bd8f0e1e333f7f064f3d168f2a9d5cfcfce2464 Mon Sep 17 00:00:00 2001 From: Branch Vincent Date: Sat, 22 Jun 2024 11:39:11 -0700 Subject: [PATCH] pulsarctl 3.3.0.3 (new formula) --- Formula/p/pulsarctl.rb | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Formula/p/pulsarctl.rb diff --git a/Formula/p/pulsarctl.rb b/Formula/p/pulsarctl.rb new file mode 100644 index 0000000000000..cce4347fe0c91 --- /dev/null +++ b/Formula/p/pulsarctl.rb @@ -0,0 +1,35 @@ +class Pulsarctl < Formula + desc "CLI for Apache Pulsar written in Go" + homepage "https://streamnative.io/" + url "https://github.com/streamnative/pulsarctl/archive/refs/tags/v3.3.0.3.tar.gz" + sha256 "8171726d64266b569fae1c6b7fadcc99f90e4117aef2e71ff54f992afbc7939e" + license "Apache-2.0" + head "https://github.com/streamnative/pulsarctl.git", branch: "master" + + livecheck do + url :stable + regex(/^v?(\d+(?:\.\d+)+)$/i) + end + + depends_on "go" => :build + + def install + ldflags = %W[ + -s -w + -X github.com/streamnative/pulsarctl/pkg/cmdutils.ReleaseVersion=v#{version} + -X github.com/streamnative/pulsarctl/pkg/cmdutils.BuildTS=#{time.iso8601} + -X github.com/streamnative/pulsarctl/pkg/cmdutils.GitHash=#{tap.user} + -X github.com/streamnative/pulsarctl/pkg/cmdutils.GitBranch=master + -X github.com/streamnative/pulsarctl/pkg/cmdutils.GoVersion=go#{Formula["go"].version} + ] + system "go", "build", *std_go_args(ldflags:) + + # Install shell completions + generate_completions_from_executable(bin/"pulsarctl", "completion") + end + + test do + assert_match version.to_s, shell_output("#{bin}/pulsarctl --version") + assert_match "connection refused", shell_output("#{bin}/pulsarctl clusters list 2>&1", 1) + end +end