homebrew-gitea/gitea-head.rb
Alexey 〒erentyev d4a33300f2 use xz archive only on supported platform (#144)
as title

Co-authored-by: Alexey Terentyev <axifnx@gmail.com>
Reviewed-on: gitea/homebrew-gitea#144
Reviewed-by: techknowlogick <techknowlogick@gitea.io>
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Alexey 〒erentyev <axifive@noreply.gitea.io>
Co-committed-by: Alexey 〒erentyev <axifive@noreply.gitea.io>
2021-10-09 12:23:39 +08:00

46 lines
1.1 KiB
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}"
@@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
conflicts_with "gitea", because: "both install gitea binaries"
bottle :unneeded
def install
if stable.using.blank?
filename = GiteaHead.class_variable_get("@@filename")
else
filename = downloader.cached_location
end
bin.install filename => "gitea"
end
test do
system "#{bin}/gitea", "--version"
end
end