feat: migrate tea into homebrew-core (#175)

Currently both are supported in homebrew-core, so it might be a good idea to consolidate and increase the collaborations :)

```
$ brew install tea
Warning: Treating tea as a formula. For the cask, use homebrew/cask/tea
==> Fetching tea
==> Downloading https://ghcr.io/v2/homebrew/core/tea/manifests/0.9.2
######################################################################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/tea/blobs/sha256:29e52360a6c2dcb368442a59161640e1cf96e565ab59d1520e42c6a2ce38b
######################################################################################################################## 100.0%
==> Pouring tea--0.9.2.arm64_ventura.bottle.tar.gz
==> Caveats
Bash completion has been installed to:
  /opt/homebrew/etc/bash_completion.d
==> Summary
🍺  /opt/homebrew/Cellar/tea/0.9.2: 9 files, 20.7MB
```

For head build, it would be:
```
$ brew install --HEAD tea
```

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/gitea/homebrew-gitea/pulls/175
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Rui Chen <rui@chenrui.dev>
Co-committed-by: Rui Chen <rui@chenrui.dev>
This commit is contained in:
Rui Chen 2023-09-04 04:10:36 +00:00 committed by Lunny Xiao
parent b0d52675ea
commit 9ff199e4dc
3 changed files with 3 additions and 104 deletions

3
tap_migrations.json Normal file
View File

@ -0,0 +1,3 @@
{
"tea": "homebrew/core"
}

View File

@ -1,48 +0,0 @@
require_relative './utils/macos_codesign.rb'
class TeaHead < Formula
desc "A command line tool to interact with Gitea servers"
homepage "https://gitea.com/gitea/tea"
version "main"
license "MIT"
os = OS.mac? ? "darwin" : "linux"
arch = case Hardware::CPU.arch
when :i386 then "386"
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.com/tea/#{version}/#{@@filename}"
@@using = :nounzip
if os == "darwin" || 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 "tea", because: "both install tea binaries"
def install
if stable.using.blank?
filename = TeaHead.class_variable_get("@@filename")
else
filename = downloader.cached_location
end
apply_ad_hoc_signature(filename)
bin.install filename => "tea"
end
test do
system "#{bin}/tea", "--version"
end
end

56
tea.rb
View File

@ -1,56 +0,0 @@
require_relative './utils/macos_codesign.rb'
class Tea < Formula
desc "A command line tool to interact with Gitea servers"
homepage "https://gitea.com/gitea/tea"
version "0.9.2"
license "MIT"
os = OS.mac? ? "darwin" : "linux"
arch = case Hardware::CPU.arch
when :i386 then "386"
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.com/tea/#{version}/#{@@filename}"
@@using = :nounzip
if os == "darwin" || arch == "amd64"
@@url += ".xz"
@@using = nil
depends_on "xz"
end
@@sha256 = case "#{os}-#{arch}"
when "linux-386" then "206e47c04f70e13abd910a4f0c0c5097a463bc8899e83d1041822f04f69c52d9" # binary
when "linux-amd64" then "32ed8217e7facc718f45d272d8549ad3d2f82735855cc25bfca525c8f72a4d8d"
when "linux-arm64" then "60d18d6c0c2939befde79afd63becc42204acbeafe89dfe46017447882676a35" # binary
when "darwin-amd64" then "96b5696bc1fa3b65292ac3ac36809e1466df574c3537bd6b0d905ebadeae67bd"
when "darwin-arm64" then "fb5e295f901837aa6290942bad5cfd7f12fd218fbce8501e0f3f63807faae236"
else
raise "tea: Unsupported system #{os}-#{arch}"
end
sha256 @@sha256
url @@url,
using: @@using
conflicts_with "tea-head", because: "both install tea binaries"
def install
if stable.using.blank?
filename = Tea.class_variable_get("@@filename")
else
filename = downloader.cached_location
end
apply_ad_hoc_signature(filename)
bin.install filename => "tea"
end
test do
system "#{bin}/tea", "--version"
end
end