|
| 1 | +class JenkinsCli < Formula |
| 2 | + desc "CLI for jenkins" |
| 3 | + homepage "https://github.com/jenkins-zh/jenkins-cli" |
| 4 | + url "https://github.com/jenkins-zh/jenkins-cli/archive/refs/tags/v0.0.47.tar.gz" |
| 5 | + sha256 "4e78600e214c357c08a0a83fe9cc59214b0d050de07dbb469d9f226c8c37eabc" |
| 6 | + license "MIT" |
| 7 | + head "https://github.com/jenkins-zh/jenkins-cli.git", branch: "master" |
| 8 | + |
| 9 | + bottle do |
| 10 | + sha256 cellar: :any_skip_relocation, arm64_sequoia: "85ed47aaf4a16751608eef650d8b7cab3e8af8c8133ed82bf6a7305004adb110" |
| 11 | + sha256 cellar: :any_skip_relocation, arm64_sonoma: "85ed47aaf4a16751608eef650d8b7cab3e8af8c8133ed82bf6a7305004adb110" |
| 12 | + sha256 cellar: :any_skip_relocation, arm64_ventura: "85ed47aaf4a16751608eef650d8b7cab3e8af8c8133ed82bf6a7305004adb110" |
| 13 | + sha256 cellar: :any_skip_relocation, sonoma: "61397dd36ee2b9195bbef96430a8aed787a0a38e733ed397c425400e03304848" |
| 14 | + sha256 cellar: :any_skip_relocation, ventura: "61397dd36ee2b9195bbef96430a8aed787a0a38e733ed397c425400e03304848" |
| 15 | + sha256 cellar: :any_skip_relocation, x86_64_linux: "b253ad3ba372e8bf59b0724c656e5ce77b8b522cd9651e731aaea6d846309e78" |
| 16 | + end |
| 17 | + |
| 18 | + depends_on "go" => :build |
| 19 | + |
| 20 | + def install |
| 21 | + ldflags = %W[ |
| 22 | + -s -w |
| 23 | + -X github.com/linuxsuren/cobra-extension/version.version=#{version} |
| 24 | + -X github.com/linuxsuren/cobra-extension/version.commit=#{tap.user} |
| 25 | + -X github.com/linuxsuren/cobra-extension/version.date=#{time.iso8601} |
| 26 | + ] |
| 27 | + system "go", "build", *std_go_args(ldflags:, output: bin/"jcli") |
| 28 | + |
| 29 | + generate_completions_from_executable(bin/"jcli", "completion") |
| 30 | + end |
| 31 | + |
| 32 | + test do |
| 33 | + assert_match version.to_s, shell_output("#{bin}/jcli version") |
| 34 | + |
| 35 | + (testpath/".jenkins-cli.yaml").write <<~EOS |
| 36 | + current: default |
| 37 | + configurations: |
| 38 | + default: |
| 39 | + url: http://localhost:8080 |
| 40 | + username: admin |
| 41 | + token: admin |
| 42 | + EOS |
| 43 | + |
| 44 | + assert_equal "Name URL Description", shell_output("#{bin}/jcli config list").chomp |
| 45 | + assert_match "Cannot found Jenkins", shell_output("#{bin}/jcli plugin list 2>&1", 1) |
| 46 | + end |
| 47 | +end |
0 commit comments