homebrew-gitea/tea-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: gitea/homebrew-gitea#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

32 lines
834 B
Ruby

class TeaHead < Formula
desc "A command line tool to interact with Gitea servers"
homepage "https://gitea.com/gitea/tea"
version "0.7.0"
os = OS.mac? ? "darwin" : "linux"
arch = case Hardware::CPU.arch
when :x86_64 then "amd64"
when :arm64 then "arm64"
else
raise "tea: Unsupported system architecture #{Hardware::CPU.arch}"
end
@@filename = "tea-#{version}-#{os}-#{arch}"
@@url = "https://dl.gitea.io/tea/#{version}/#{@@filename}.xz"
@@sha256 = %x[ curl -sL #{@@url}.sha256 ].split.first
url @@url
sha256 @@sha256
conflicts_with "tea", because: "both install tea binaries"
bottle :unneeded
def install
filename = TeaHead.class_variable_get("@@filename")
bin.install filename => "tea"
end
test do
system "#{bin}/tea", "--version"
end
end