homebrew-core/Formula/kamel.rb

66 lines
2.3 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.2.1",
revision: "476ed0e600abe6fe54de19225f8f0c18d6bcbfa9"
license "Apache-2.0"
head "https://github.com/apache/camel-k.git"
livecheck do
url :head
regex(/^v?(\d+(?:\.\d+)+)$/i)
end
bottle do
cellar :any_skip_relocation
sha256 "5c7d830dca2368d17098a2566dc51f302105bedca5c31a5163c3effb8fdcb8bb" => :big_sur
sha256 "6c26b781979d7aa4270d382f8b7644fe7fb4f64d3439637945c60ce2a9eddbe6" => :catalina
sha256 "2764ee91d35712ebf2930df31e3254ccb0c31b60f42288e5963bf2f79729ddb3" => :mojave
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 "Error: cannot get command client: invalid configuration", 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 "Error: cannot read file 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