Make changelog match new shipping method (#137)

I forgot about this one on !136 😅️

Also, fix #134. And I think you may close #108, as I'm writing and testing using Linuxbrew.

Co-authored-by: Marcos de Oliveira <markinholiveira@gmail.com>
Reviewed-on: https://gitea.com/gitea/homebrew-gitea/pulls/137
Reviewed-by: Andrew Thornton <art27@cantab.net>
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: markkrj <markkrj@noreply.gitea.io>
Co-committed-by: markkrj <markkrj@noreply.gitea.io>
This commit is contained in:
markkrj 2021-07-04 17:35:15 +08:00 committed by Lunny Xiao
parent 10c0dc82d8
commit 05af00386a
1 changed files with 20 additions and 35 deletions

View File

@ -1,46 +1,31 @@
require "formula"
class Changelog < Formula
desc "Generate changelog of gitea repository"
homepage "https://gitea.com/gitea/changelog"
head "https://gitea.com/gitea/changelog.git"
version "master"
stable do
version "0.1.0"
url "https://dl.gitea.io/changelog-tool/#{version}/changelog-#{version}-darwin-10.6-amd64"
sha256 `curl -s https://dl.gitea.io/changelog-tool/#{version}/changelog-#{version}-darwin-10.6-amd64.sha256`.split(" ").first
end
os = OS.mac? ? "darwin-10.6" : "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
head do
url "https://dl.gitea.io/changelog-tool/master/changelog-master-darwin-10.6-amd64"
sha256 `curl -s https://dl.gitea.io/changelog-tool/master/changelog-master-darwin-10.6-amd64.sha256`.split(" ").first
version "master"
end
@@filename = "changelog-#{version}-#{os}-#{arch}"
@@url = "https://dl.gitea.io/changelog-tool/#{version}/#{@@filename}.xz"
@@sha256 = %x[ curl -sL #{@@url}.sha256 ].split.first
head do
url "https://gitea.com/gitea/changelog.git", :branch => "master"
depends_on "go" => :build
url @@url
sha256 @@sha256
bottle :unneeded
def install
filename = Changelog.class_variable_get("@@filename")
bin.install filename => "changelog"
end
test do
system "#{bin}/changelog", "--version"
end
def install
case
when build.head?
mkdir_p buildpath/File.join("src", "code.gitea.io")
ln_s buildpath, buildpath/File.join("src", "code.gitea.io", "changelog")
ENV.append_path "PATH", File.join(buildpath, "bin")
ENV["GOPATH"] = buildpath
ENV["GOHOME"] = buildpath
system "cd src/code.gitea.io/changelog && make build"
bin.install "#{buildpath}/changelog" => "changelog"
else
bin.install "#{buildpath}/changelog-#{version}-darwin-10.6-amd64" => "changelog"
end
end
end