-
-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
368022c
commit 4bd8f0e
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |