Merge pull request #198803 from Homebrew/bump-wizcli-0.69.0
[Homebrew/homebrew-cask.git] / Casks / w / windterm.rb
blob5f34ee9400211afd7d4ee9f5b272788e6a173d69
1 cask "windterm" do
2   version "2.6.1,2.6.0"
3   sha256 "c1a1ff2263b3ded7816c8d2e7309e77f3d0901d488c8559281cfd4d2bb7b891b"
5   url "https://github.com/kingToolbox/WindTerm/releases/download/#{version.csv.second || version.csv.first}/WindTerm_#{version.csv.first}_Mac_Portable_x86_64.dmg"
6   name "WindTerm"
7   desc "SSH/SFTP/Shell/Telnet/Serial terminal"
8   homepage "https://github.com/kingToolbox/WindTerm"
10   # Upstream doesn't provide a macOS file with every release, so we have to
11   # check multiple GitHub releases instead of only the "latest" one. They also
12   # seem to regularly add patch versions to existing releases (e.g., adding
13   # 2.6.1 files to the 2.6.0 release), so we optionally append the tag version
14   # if it differs from the file version.
15   livecheck do
16     url :url
17     regex(/WindTerm[._-]v?(\d+(?:\.\d+)+)(?:[._-]Mac|.*\.dmg)/i)
18     strategy :github_releases do |json, regex|
19       json.map do |release|
20         next if release["draft"] || release["prerelease"]
22         tag_version = release["tag_name"]&.[](/^v?(\d+(?:\.\d+)+)$/i, 1)
23         next if tag_version.blank?
25         release["assets"]&.map do |asset|
26           match = asset["name"]&.match(regex)
27           next if match.blank?
29           (match[1] == tag_version) ? tag_version : "#{match[1]},#{tag_version}"
30         end
31       end.flatten
32     end
33   end
35   auto_updates true
36   depends_on macos: ">= :high_sierra"
38   app "WindTerm.app"
40   zap trash: [
41     "~/Library/Preferences/KingToolbox.WindTerm.plist",
42     "~/Library/Saved Application State/KingToolbox.WindTerm.savedState",
43   ]
45   caveats do
46     requires_rosetta
47   end
48 end