homebrew-core/Formula/kamel.rb

67 lines
2.6 KiB
Ruby

class Kamel < Formula
desc "Apache Camel K CLI"
homepage "https://camel.apache.org/"
url "https://github.com/apache/camel-k.git",
tag: "v1.6.0",
revision: "e929db111d6d8ac000f9262342cb3d2eed157aad"
license "Apache-2.0"
head "https://github.com/apache/camel-k.git"
livecheck do
url :stable
strategy :github_latest
end
bottle do
sha256 cellar: :any_skip_relocation, arm64_big_sur: "b04e659ed41867ffe0cf799af99263c6d8a04217fd98397aac66c320caf6cfa2"
sha256 cellar: :any_skip_relocation, big_sur: "502265a622bc26ec8989c1f7040ac487611047d64ecaf96ecbb06228dad6b575"
sha256 cellar: :any_skip_relocation, catalina: "03358c7bd13d985564f394a28b213305d2b01726cb7cec864b9005e092d24001"
sha256 cellar: :any_skip_relocation, mojave: "7a1badc7d4dee8911535d1bb5af005acd96d2ff7d0ecd9b5e6f61cde7dce10ec"
sha256 cellar: :any_skip_relocation, x86_64_linux: "9f38fda50052a0f9121ff41000103b7b0a3f42e159911d53a99f8e1df39fe0a5"
end
depends_on "go" => :build
depends_on "openjdk@11" => :build
def install
ENV["JAVA_HOME"] = Language::Java.java_home("11")
system "make"
bin.install "kamel"
output = Utils.safe_popen_read("#{bin}/kamel", "completion", "bash")
(bash_completion/"kamel").write output
output = Utils.safe_popen_read("#{bin}/kamel", "completion", "zsh")
(zsh_completion/"_kamel").write output
end
test do
run_output = shell_output("#{bin}/kamel 2>&1")
assert_match "Apache Camel K is a lightweight", run_output
help_output = shell_output("echo $(#{bin}/kamel help 2>&1)")
assert_match "kamel [command] --help", help_output.chomp
get_output = shell_output("echo $(#{bin}/kamel get 2>&1)")
assert_match "Error: cannot get command client: invalid configuration", get_output
version_output = shell_output("echo $(#{bin}/kamel version 2>&1)")
assert_match version.to_s, version_output
run_output = shell_output("echo $(#{bin}/kamel run 2>&1)")
assert_match "Error: run expects at least 1 argument, received 0", run_output
run_none_output = shell_output("echo $(#{bin}/kamel run None.java 2>&1)")
assert_match "cannot read sources: Missing file or unsupported scheme in None.java", run_none_output
reset_output = shell_output("echo $(#{bin}/kamel reset 2>&1)")
assert_match "Error: cannot get command client: invalid configuration", reset_output
rebuild_output = shell_output("echo $(#{bin}/kamel rebuild 2>&1)")
assert_match "Config not found", rebuild_output
reset_output = shell_output("echo $(#{bin}/kamel reset 2>&1)")
assert_match "Config not found", reset_output
end
end