mirror of
https://github.com/wavetermdev/homebrew-cask.git
synced 2026-08-05 13:43:24 -07:00
Merge pull request #160540 from samford/livecheck/use-GithubReleases-strategy
This commit is contained in:
@@ -16,12 +16,19 @@ cask "eloston-chromium" do
|
||||
desc "Google Chromium, sans integration with Google"
|
||||
homepage "https://ungoogled-software.github.io/ungoogled-chromium-binaries/"
|
||||
|
||||
# Releases are separated by architecture, so we have to check multiple recent
|
||||
# releases instead of only the "latest" release.
|
||||
livecheck do
|
||||
url "https://github.com/ungoogled-software/ungoogled-chromium-macos/releases?q=prerelease%3Afalse"
|
||||
regex(%r{href=["']?[^"' >]*?/tree/v?(\d+(?:[.-]\d+)+)(?:[._-]#{arch})?(?:[._-]+?(\d+(?:\.\d+)*))?["' >]}i)
|
||||
strategy :page_match do |page, regex|
|
||||
page.scan(regex).map do |match|
|
||||
(match.length > 1) ? "#{match[0]},#{match[1]}" : match[0]
|
||||
url :url
|
||||
regex(/^v?(\d+(?:[.-]\d+)+)(?:[._-]#{arch})?(?:[._-]+?(\d+(?:\.\d+)*))?$/i)
|
||||
strategy :github_releases do |json, regex|
|
||||
json.map do |release|
|
||||
next if release["draft"] || release["prerelease"]
|
||||
|
||||
match = release["tag_name"]&.match(regex)
|
||||
next if match.blank?
|
||||
|
||||
(match.length >= 2) ? "#{match[1]},#{match[2]}" : match[1]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
+14
-3
@@ -12,9 +12,20 @@ cask "extraterm" do
|
||||
# This should be updated to use the `GithubLatest` strategy if/when stable
|
||||
# versions become available.
|
||||
livecheck do
|
||||
url "https://github.com/sedwards2009/extraterm/releases"
|
||||
regex(%r{href=["']?[^"' >]*?/tag/v?(\d+(?:\.\d+)+)["' >]}i)
|
||||
strategy :page_match
|
||||
url :url
|
||||
regex(/^v?(\d+(?:\.\d+)+)$/i)
|
||||
strategy :github_releases do |json, regex|
|
||||
json.map do |release|
|
||||
# This omits the usual `release["prerelease"]` early return condition,
|
||||
# as we need to work with pre-release versions for now.
|
||||
next if release["draft"]
|
||||
|
||||
match = release["tag_name"]&.match(regex)
|
||||
next if match.blank?
|
||||
|
||||
match[1]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
app "ExtratermQt.app"
|
||||
|
||||
@@ -10,28 +10,22 @@ cask "forkgram-telegram" do
|
||||
desc "Fork of Telegram Desktop"
|
||||
homepage "https://github.com/Forkgram/"
|
||||
|
||||
# NOTE: This approach involves multiple requests and should be avoided
|
||||
# whenever possible. If upstream starts reliably providing the macOS zip
|
||||
# files in every release, we should switch to `url :url` with
|
||||
# `strategy :github_latest`.
|
||||
# Not every GitHub release provides a file for macOS, so we check multiple
|
||||
# recent releases instead of only the "latest" release.
|
||||
livecheck do
|
||||
url "https://github.com/Forkgram/tdesktop/releases?q=prerelease%3Afalse"
|
||||
regex(%r{/v?(\d+(?:\.\d+)+)/Forkgram[._-]macOS[._-][^"' >]*?#{arch}\.zip}i)
|
||||
strategy :page_match do |page, regex|
|
||||
# Collect the release tags on the page
|
||||
tags = page.scan(%r{href=["']?[^"' >]*?/releases/tag/([^"' >]*?)["' >]}i)&.flatten&.uniq
|
||||
url :url
|
||||
regex(/^v?(\d+(?:\.\d+)+)$/i)
|
||||
strategy :github_releases do |json, regex|
|
||||
file_regex = /^Forkgram[._-]macOS[._-].*?#{arch}\.zip$/i
|
||||
|
||||
max_reqs = 4
|
||||
tags.each_with_index do |tag, i|
|
||||
break if i >= max_reqs
|
||||
json.map do |release|
|
||||
next if release["draft"] || release["prerelease"]
|
||||
next unless release["assets"]&.any? { |asset| asset["name"]&.match?(file_regex) }
|
||||
|
||||
# Fetch the assets list HTML for the tag and match within it
|
||||
assets_page = Homebrew::Livecheck::Strategy.page_content(
|
||||
@url.sub(%r{/releases/?.+}, "/releases/expanded_assets/#{tag}"),
|
||||
)
|
||||
matches = assets_page[:content]&.scan(regex)&.map { |match| match[0] }
|
||||
match = release["tag_name"].match(regex)
|
||||
next if match.blank?
|
||||
|
||||
break matches if matches.present?
|
||||
match[1]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
+15
-8
@@ -25,16 +25,23 @@ cask "free-gpgmail" do
|
||||
# cask `version` (based on the execution environment). As such, this won't
|
||||
# surface a new major version and that will need to be handled manually.
|
||||
livecheck do
|
||||
url "https://github.com/Free-GPGMail/Free-GPGMail/releases?q=prerelease%3Afalse"
|
||||
regex(/.*?Free-GPGMail[._-]v?(\d+(?:\.\d+)*)[_-](\d+(?:\.\d+)+)([_-][^"' >]+?)?[._-]mailbundle\.zip/i)
|
||||
strategy :page_match do |page, regex|
|
||||
url :url
|
||||
regex(/^Free-GPGMail[._-]v?(\d+(?:\.\d+)*)[_-](\d+(?:\.\d+)+)([_-].+?)?[._-]mailbundle\.zip$/i)
|
||||
strategy :github_releases do |json, regex|
|
||||
version_suffix = version.csv.third&.sub(/^[_-]/, "")
|
||||
page.scan(regex).map do |match|
|
||||
next if match[0].split(".").first != version.csv.first.split(".").first
|
||||
next if match[2]&.sub(/^[_-]/, "") != version_suffix
|
||||
|
||||
"#{match[0]},#{match[1]},#{match[2]}"
|
||||
end
|
||||
json.map do |release|
|
||||
next if release["draft"] || release["prerelease"]
|
||||
|
||||
release["assets"]&.map do |asset|
|
||||
match = asset["name"]&.match(regex)
|
||||
next if match.blank?
|
||||
next if match[1].split(".").first != version.csv.first.split(".").first
|
||||
next if match[3]&.sub(/^[_-]/, "") != version_suffix
|
||||
|
||||
"#{match[1]},#{match[2]},#{match[3]}"
|
||||
end
|
||||
end.flatten
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -11,9 +11,8 @@ cask "obs-websocket" do
|
||||
# "latest" release may be for an older major version. Unless/until this is
|
||||
# resolved, we have to check more than just the "latest" release.
|
||||
livecheck do
|
||||
url "https://github.com/obsproject/obs-websocket/releases?q=prerelease%3Afalse"
|
||||
regex(%r{href=["']?[^"' >]*?/tag/v?(\d+(?:\.\d+)+)[^"' >]*?["' >]}i)
|
||||
strategy :page_match
|
||||
url :url
|
||||
strategy :github_releases
|
||||
end
|
||||
|
||||
pkg "obs-websocket-#{version}-macOS.pkg"
|
||||
|
||||
+12
-18
@@ -11,28 +11,22 @@ cask "wine-stable" do
|
||||
desc "Compatibility layer to run Windows applications"
|
||||
homepage "https://wiki.winehq.org/MacOS"
|
||||
|
||||
# NOTE: This approach involves multiple requests and should be avoided
|
||||
# whenever possible. If upstream starts reliably providing `wine-stable` zip
|
||||
# files in every release, we should switch to `url :url` with
|
||||
# `strategy :github_latest`.
|
||||
# Not every GitHub release provides a `wine-stable` file, so we check multiple
|
||||
# recent releases instead of only the "latest" release.
|
||||
livecheck do
|
||||
url "https://github.com/Gcenx/macOS_Wine_builds/releases?q=prerelease%3Afalse"
|
||||
regex(%r{/v?(\d+(?:\.\d+)+)/wine-stable[._-][^"' >]*?\.t}i)
|
||||
strategy :page_match do |page, regex|
|
||||
# Collect the release tags on the page
|
||||
tags = page.scan(%r{href=["']?[^"' >]*?/releases/tag/([^"' >]*?)["' >]}i)&.flatten&.uniq
|
||||
url :url
|
||||
regex(/^v?(\d+(?:[.-]\d+)+)$/i)
|
||||
strategy :github_releases do |json, regex|
|
||||
file_regex = /^wine-stable[._-].*?$/i
|
||||
|
||||
max_reqs = 6
|
||||
tags.each_with_index do |tag, i|
|
||||
break if i >= max_reqs
|
||||
json.map do |release|
|
||||
next if release["draft"] || release["prerelease"]
|
||||
next unless release["assets"]&.any? { |asset| asset["name"]&.match?(file_regex) }
|
||||
|
||||
# Fetch the assets list HTML for the tag and match within it
|
||||
assets_page = Homebrew::Livecheck::Strategy.page_content(
|
||||
@url.sub(%r{/releases/?.+}, "/releases/expanded_assets/#{tag}"),
|
||||
)
|
||||
matches = assets_page[:content]&.scan(regex)&.map { |match| match[0] }
|
||||
match = release["tag_name"].match(regex)
|
||||
next if match.blank?
|
||||
|
||||
break matches if matches.present?
|
||||
match[1]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user