homebrew-core/Formula/kyma-cli.rb

34 lines
1.2 KiB
Ruby

class KymaCli < Formula
desc "Kyma command-line interface"
homepage "https://kyma-project.io"
url "https://github.com/kyma-project/cli/archive/1.22.0.tar.gz"
sha256 "e67a2ac40232a905159a411996f2c6ac1e7001c8946a6ccdde8139202276acd2"
license "Apache-2.0"
head "https://github.com/kyma-project/cli.git"
bottle do
sha256 cellar: :any_skip_relocation, big_sur: "d895640623ccfa1e1fffe08cd24af86412a85c512df3ff77b3d972e5e176e9d8"
sha256 cellar: :any_skip_relocation, catalina: "2fa6250550b49678eea9991ef3076bfe3dc0505d8d44c249b9f8b0e7d64dacc5"
end
depends_on "go" => :build
depends_on macos: :catalina
def install
ldflags = %W[
-s -w
-X github.com/kyma-project/cli/cmd/kyma/version.Version=#{version}
-X github.com/kyma-project/cli/cmd/kyma/install.DefaultKymaVersion=#{version}
-X github.com/kyma-project/cli/cmd/kyma/upgrade.DefaultKymaVersion=#{version}
].join(" ")
system "go", "build", *std_go_args, "-o", bin/"kyma", "-ldflags", ldflags, "./cmd"
end
test do
touch testpath/"kubeconfig"
assert_match "invalid configuration",
shell_output("#{bin}/kyma install --kubeconfig ./kubeconfig 2>&1", 1)
end
end