jackett 0.22.1382
[Homebrew/homebrew-core.git] / Formula / r / redress.rb
blob187037b0aad36a572d40b6380ad7b875d340c5c2
1 class Redress < Formula
2   desc "Tool for analyzing stripped Go binaries compiled with the Go compiler"
3   homepage "https://github.com/goretk/redress"
4   url "https://github.com/goretk/redress/archive/refs/tags/v1.2.12.tar.gz"
5   sha256 "1a51dfc4630e4ca61bd5d90c656bc4db4a0a24472a95be96fac1d66b12657db8"
6   license "AGPL-3.0-only"
7   head "https://github.com/goretk/redress.git", branch: "develop"
9   livecheck do
10     url :stable
11     regex(/^v?(\d+(?:\.\d+)+)$/i)
12   end
14   bottle do
15     sha256 cellar: :any_skip_relocation, arm64_sequoia: "3b7cb876ca963b9d34c0a699d1bbb7f402766a820dbb589a0566282c1973e142"
16     sha256 cellar: :any_skip_relocation, arm64_sonoma:  "3b7cb876ca963b9d34c0a699d1bbb7f402766a820dbb589a0566282c1973e142"
17     sha256 cellar: :any_skip_relocation, arm64_ventura: "3b7cb876ca963b9d34c0a699d1bbb7f402766a820dbb589a0566282c1973e142"
18     sha256 cellar: :any_skip_relocation, sonoma:        "233e4b6d6a5f054cd5de36ef613ff55c1aa49caa90e33b7418c4532e7b08a4cc"
19     sha256 cellar: :any_skip_relocation, ventura:       "233e4b6d6a5f054cd5de36ef613ff55c1aa49caa90e33b7418c4532e7b08a4cc"
20     sha256 cellar: :any_skip_relocation, x86_64_linux:  "2f9165b197e0bfe6e0e7f202fe110353b38f673f5e7b704445afbecceeabc5cf"
21   end
23   depends_on "go" => :build
25   def install
26     # https://github.com/goretk/redress/blob/develop/Makefile#L11-L14
27     gore_version = File.read(buildpath/"go.mod").scan(%r{goretk/gore v(\S+)}).flatten.first
29     ldflags = %W[
30       -s -w
31       -X main.redressVersion=#{version}
32       -X main.goreVersion=#{gore_version}
33       -X main.compilerVersion=#{Formula["go"].version}
34     ]
36     system "go", "build", *std_go_args(ldflags:)
38     generate_completions_from_executable(bin/"redress", "completion")
39   end
41   test do
42     assert_match "Version:  #{version}", shell_output("#{bin}/redress version")
44     test_module_root = "github.com/goretk/redress"
45     test_bin_path = bin/"redress"
47     output = shell_output("#{bin}/redress info '#{test_bin_path}'")
48     assert_match(/Main root\s+#{Regexp.escape(test_module_root)}/, output)
49   end
50 end