|
| 1 | +class KafkactlAwsPlugin < Formula |
| 2 | + desc "AWS 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: "a853dba2c902a4e1d8ad91d315c87cb95f3f37f58c9699e59890a46442b285b7" |
| 10 | + sha256 cellar: :any_skip_relocation, arm64_sonoma: "a853dba2c902a4e1d8ad91d315c87cb95f3f37f58c9699e59890a46442b285b7" |
| 11 | + sha256 cellar: :any_skip_relocation, arm64_ventura: "a853dba2c902a4e1d8ad91d315c87cb95f3f37f58c9699e59890a46442b285b7" |
| 12 | + sha256 cellar: :any_skip_relocation, sonoma: "b8bd50ecbe9bc6140fdd5d2eeb0fbabc889958565b16785f4e22f28784d3d49b" |
| 13 | + sha256 cellar: :any_skip_relocation, ventura: "b8bd50ecbe9bc6140fdd5d2eeb0fbabc889958565b16785f4e22f28784d3d49b" |
| 14 | + sha256 cellar: :any_skip_relocation, x86_64_linux: "9a3e72893fc1633d75bb8ef3643138d095697bb52664d4972a639248fbd90d66" |
| 15 | + end |
| 16 | + |
| 17 | + depends_on "go" => :build |
| 18 | + depends_on "kafkactl" |
| 19 | + |
| 20 | + def install |
| 21 | + Dir.chdir("aws") 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-aws-plugin 2>&1", 1) |
| 34 | + config_file = testpath/".kafkactl.yml" |
| 35 | + config_file.write <<~YAML |
| 36 | + contexts: |
| 37 | + default: |
| 38 | + brokers: |
| 39 | + - unknown-cluster.kafka.eu-west-1.amazonaws.com:9098 |
| 40 | + sasl: |
| 41 | + enabled: true |
| 42 | + mechanism: oauth |
| 43 | + tokenprovider: |
| 44 | + plugin: aws |
| 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-aws-plugin: plugin initialized", output |
| 54 | + end |
| 55 | +end |
0 commit comments