homebrew-gitea/changelog.rb
techknowlogick dca3f772d8 relative require? (#150)
🧙

Reviewed-on: gitea/homebrew-gitea#150
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-committed-by: techknowlogick <techknowlogick@gitea.io>
2021-11-29 05:12:27 +08:00

47 lines
1.1 KiB
Ruby

require_relative './utils/macos_codesign.rb'
class Changelog < Formula
desc "Generate changelog of gitea repository"
homepage "https://gitea.com/gitea/changelog"
version "master"
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.io/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