homebrew-core/Formula/odo-dev.rb

41 lines
1.4 KiB
Ruby

class OdoDev < Formula
desc "Developer-focused CLI for Kubernetes and OpenShift"
homepage "https://odo.dev"
url "https://github.com/redhat-developer/odo.git",
tag: "v3.6.0",
revision: "5b4959272f71b2113f6d29f17d035bfd83781575"
license "Apache-2.0"
head "https://github.com/redhat-developer/odo.git", branch: "main"
bottle do
sha256 cellar: :any_skip_relocation, arm64_monterey: "acc7899b7060ba2ed4c4dc1883ce0c91ec104b39307b5369dc34d9017839293f"
end
depends_on "go" => :build
conflicts_with "odo", because: "odo also ships 'odo' binary"
def install
system "make", "bin"
bin.install "odo"
end
test do
# try set preference
ENV["GLOBALODOCONFIG"] = "#{testpath}/preference.yaml"
system bin/"odo", "preference", "set", "ConsentTelemetry", "false"
system bin/"odo", "preference", "add", "registry", "StagingRegistry", "https://registry.stage.devfile.io"
assert_predicate testpath/"preference.yaml", :exist?
# test version
version_output = shell_output("#{bin}/odo version --client 2>&1").strip
assert_match(/odo v#{version} \([a-f0-9]{9}\)/, version_output)
# try to create a new component
system bin/"odo", "init", "--devfile", "nodejs", "--name", "test", "--devfile-registry", "StagingRegistry"
assert_predicate testpath/"devfile.yaml", :exist?
dev_output = shell_output("#{bin}/odo dev 2>&1", 1).strip
assert_match "no connection to cluster defined", dev_output
end
end