|
| 1 | +class KafkactlAzurePlugin < Formula |
| 2 | + desc "Azure Plugin for kafkactl" |
| 3 | + homepage "https://deviceinsight.github.io/kafkactl/" |
| 4 | + url "https://github.com/deviceinsight/kafkactl-plugins/archive/refs/tags/v1.3.0.tar.gz" |
| 5 | + sha256 "9fcab4135e68ffba6af40db21ab4c36f798a502be402f6c2d6557d316084b445" |
| 6 | + license "Apache-2.0" |
| 7 | + |
| 8 | + bottle do |
| 9 | + sha256 cellar: :any_skip_relocation, arm64_sequoia: "2b97afe54ae1f03eb046716a66ec69d64c74aae7305a2267181f41224fcdf2b0" |
| 10 | + sha256 cellar: :any_skip_relocation, arm64_sonoma: "2b97afe54ae1f03eb046716a66ec69d64c74aae7305a2267181f41224fcdf2b0" |
| 11 | + sha256 cellar: :any_skip_relocation, arm64_ventura: "2b97afe54ae1f03eb046716a66ec69d64c74aae7305a2267181f41224fcdf2b0" |
| 12 | + sha256 cellar: :any_skip_relocation, sonoma: "862703df9342e028fdf0270979fc813ab430e5911e40562cf1e07e08b83510a0" |
| 13 | + sha256 cellar: :any_skip_relocation, ventura: "862703df9342e028fdf0270979fc813ab430e5911e40562cf1e07e08b83510a0" |
| 14 | + sha256 cellar: :any_skip_relocation, x86_64_linux: "f5287bc5567ffa87f2b5e16f8515046d68b98f4becc838cbd081a50eff08ef32" |
| 15 | + end |
| 16 | + |
| 17 | + depends_on "go" => :build |
| 18 | + depends_on "kafkactl" |
| 19 | + |
| 20 | + def install |
| 21 | + Dir.chdir("azure") do |
| 22 | + ldflags = %W[ |
| 23 | + -s -w |
| 24 | + -X main.Version=v#{version} |
| 25 | + -X main.GitCommit=#{tap.user} |
| 26 | + -X main.BuildTime=#{time.iso8601} |
| 27 | + ] |
| 28 | + system "go", "build", *std_go_args(ldflags:) |
| 29 | + end |
| 30 | + end |
| 31 | + |
| 32 | + test do |
| 33 | + assert_match version.to_s, shell_output("#{bin}/kafkactl-azure-plugin 2>&1", 1) |
| 34 | + config_file = testpath/".kafkactl.yml" |
| 35 | + config_file.write <<~YAML |
| 36 | + contexts: |
| 37 | + default: |
| 38 | + brokers: |
| 39 | + - unknown-namespace.servicebus.windows.net:9093 |
| 40 | + sasl: |
| 41 | + enabled: true |
| 42 | + mechanism: oauth |
| 43 | + tokenprovider: |
| 44 | + plugin: azure |
| 45 | + tls: |
| 46 | + enabled: true |
| 47 | + YAML |
| 48 | + |
| 49 | + ENV["KAFKA_CTL_PLUGIN_PATHS"] = bin |
| 50 | + |
| 51 | + kafkactl = Formula["kafkactl"].bin/"kafkactl" |
| 52 | + output = shell_output("#{kafkactl} -C #{config_file} get topics -V 2>&1", 1) |
| 53 | + assert_match "kafkactl-azure-plugin: plugin initialized", output |
| 54 | + end |
| 55 | +end |
0 commit comments