homebrew-gitea/gitea-head.rb
markkrj 10c0dc82d8 Fix homebrew tap by removing head and shipping compiled binaries (#136)
fixes #135

This fix Homebrew tap by removing the head method and shipping only pre-compiled binaries, as you guys already ship binaries for most (all?) supported platforms.

Also, for gitea.rb and tea.rb, I removed the curl for fetching files checksum, because for every install, it runs `curl` 5 times, slowing the install. So, I created a script to bump versions to latest and fix sha256 checksum in the formula files.

I created also an gitea-head and tea-head formulae to download latest pre-compiled binaries for head, and here we are fetching checksum by `curl`, as I imagine, it is not common/recommended scenario.

IMO, this is the best possible approach for shipping binaries from a custom tap.

Co-authored-by: Marcos de Oliveira <markinholiveira@gmail.com>
Reviewed-on: https://gitea.com/gitea/homebrew-gitea/pulls/136
Reviewed-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: markkrj <markkrj@noreply.gitea.io>
Co-committed-by: markkrj <markkrj@noreply.gitea.io>
2021-06-30 02:00:18 +08:00

33 lines
882 B
Ruby

class GiteaHead < Formula
desc "Git with a cup of tea, painless self-hosted git service"
homepage "https://gitea.io"
version "main"
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 "gitea: Unsupported system architecture #{Hardware::CPU.arch}"
end
@@filename = "gitea-#{version}-#{os}-#{arch}"
@@url = "https://dl.gitea.io/gitea/#{version}/#{@@filename}.xz"
@@sha256 = %x[ curl -sL #{@@url}.sha256 ].split.first
url @@url
sha256 @@sha256
conflicts_with "gitea", because: "both install gitea binaries"
bottle :unneeded
def install
filename = GiteaHead.class_variable_get("@@filename")
bin.install filename => "gitea"
end
test do
system "#{bin}/gitea", "--version"
end
end