From 37fce161cdfb9c80e83dc69ee76631817f128943 Mon Sep 17 00:00:00 2001 From: Adrian Ho Date: Wed, 4 Sep 2024 00:02:57 +0800 Subject: [PATCH] gh: update 2.55.0 bottle. --- Formula/g/gh.rb | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 Formula/g/gh.rb diff --git a/Formula/g/gh.rb b/Formula/g/gh.rb new file mode 100644 index 00000000000..ea62b1af2ef --- /dev/null +++ b/Formula/g/gh.rb @@ -0,0 +1,46 @@ +class Gh < Formula + desc "GitHub command-line tool" + homepage "https://cli.github.com/" + url "https://github.com/cli/cli/archive/refs/tags/v2.55.0.tar.gz" + sha256 "f467cfdaedd372a5c20bb0daad017a0b3f75fa25179f1e4dcdc1d01ed59e62a5" + license "MIT" + head "https://github.com/cli/cli.git", branch: "trunk" + + livecheck do + url :stable + strategy :github_latest + end + + bottle do + root_url "https://github.com/gromgit/homebrew-core-aarch64_linux/releases/download/gh-2.55.0" + sha256 cellar: :any_skip_relocation, aarch64_linux: "c8e09f224a879d1de1e89ef29f0403489803be898d469417145338fa4c97c40e" + end + + depends_on "go" => :build + + deny_network_access! [:postinstall, :test] + + def install + gh_version = if build.stable? + version.to_s + else + Utils.safe_popen_read("git", "describe", "--tags", "--dirty").chomp + end + + with_env( + "GH_VERSION" => gh_version, + "GO_LDFLAGS" => "-s -w -X main.updaterEnabled=cli/cli", + ) do + system "make", "bin/gh", "manpages" + end + bin.install "bin/gh" + man1.install Dir["share/man/man1/gh*.1"] + generate_completions_from_executable(bin/"gh", "completion", "-s") + end + + test do + assert_match "gh version #{version}", shell_output("#{bin}/gh --version") + assert_match "Work with GitHub issues", shell_output("#{bin}/gh issue 2>&1") + assert_match "Work with GitHub pull requests", shell_output("#{bin}/gh pr 2>&1") + end +end