-
-
Notifications
You must be signed in to change notification settings - Fork 12.7k
/
Copy pathredress.rb
50 lines (40 loc) · 2.01 KB
/
redress.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
class Redress < Formula
desc "Tool for analyzing stripped Go binaries compiled with the Go compiler"
homepage "https://github.com/goretk/redress"
url "https://github.com/goretk/redress/archive/refs/tags/v1.2.24.tar.gz"
sha256 "f1dffd4b59fd88405b46883e3cc7f32818392ff1007037db4719b2c44d35aeef"
license "AGPL-3.0-only"
head "https://github.com/goretk/redress.git", branch: "develop"
livecheck do
url :stable
regex(/^v?(\d+(?:\.\d+)+)$/i)
end
bottle do
sha256 cellar: :any_skip_relocation, arm64_sequoia: "7e4dfaa0d98718041d1116caed79445a3af8471542c8798db95b0c865ad4622a"
sha256 cellar: :any_skip_relocation, arm64_sonoma: "7e4dfaa0d98718041d1116caed79445a3af8471542c8798db95b0c865ad4622a"
sha256 cellar: :any_skip_relocation, arm64_ventura: "7e4dfaa0d98718041d1116caed79445a3af8471542c8798db95b0c865ad4622a"
sha256 cellar: :any_skip_relocation, sonoma: "e92045f84c46eabbd0be30211112281caa71803ca6b6e19b45d854f240fc22ba"
sha256 cellar: :any_skip_relocation, ventura: "e92045f84c46eabbd0be30211112281caa71803ca6b6e19b45d854f240fc22ba"
sha256 cellar: :any_skip_relocation, x86_64_linux: "eb2b111080a98120f497a23628a87a69f3de34317558909865f2cc43c392f428"
end
depends_on "go" => :build
def install
# https://github.com/goretk/redress/blob/develop/Makefile#L11-L14
gore_version = File.read(buildpath/"go.mod").scan(%r{goretk/gore v(\S+)}).flatten.first
ldflags = %W[
-s -w
-X main.redressVersion=#{version}
-X main.goreVersion=#{gore_version}
-X main.compilerVersion=#{Formula["go"].version}
]
system "go", "build", *std_go_args(ldflags:)
generate_completions_from_executable(bin/"redress", "completion")
end
test do
assert_match "Version: #{version}", shell_output("#{bin}/redress version")
test_module_root = "github.com/goretk/redress"
test_bin_path = bin/"redress"
output = shell_output("#{bin}/redress info '#{test_bin_path}'")
assert_match(/Main root\s+#{Regexp.escape(test_module_root)}/, output)
end
end