-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchangelog.rb
47 lines (39 loc) · 1.14 KB
/
changelog.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
require_relative './utils/macos_codesign.rb'
class Changelog < Formula
desc "Generate changelog of gitea repository"
homepage "https://gitea.com/gitea/changelog"
version "main"
license "MIT"
os = OS.mac? ? "darwin-10.12" : "linux"
arch = case Hardware::CPU.arch
when :i386 then "386"
when :x86_64 then "amd64"
when :arm64 then "arm64"
else
raise "changelog: Unsupported system architecture #{Hardware::CPU.arch}"
end
@@filename = "changelog-#{version}-#{os}-#{arch}"
@@url = "https://dl.gitea.com/changelog-tool/#{version}/#{@@filename}"
@@using = :nounzip
if os == "darwin-10.12" || arch == "amd64"
@@url += ".xz"
@@using = nil
depends_on "xz"
end
@@sha256 = %x[ curl -sL #{@@url}.sha256 ].split.first
sha256 @@sha256
url @@url,
using: @@using
def install
if stable.using.blank?
filename = Changelog.class_variable_get("@@filename")
else
filename = downloader.cached_location
end
apply_ad_hoc_signature(filename)
bin.install filename => "changelog"
end
test do
system "#{bin}/changelog", "--version"
end
end