cockatrice: rebuild

Fix livecheck

Closes #133425.

Signed-off-by: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com>
This commit is contained in:
Patrick Linnane
2022-10-13 06:46:01 +00:00
committed by BrewTestBot
parent 80f63528b1
commit ea5f91a92d
+13 -5
View File
@@ -23,12 +23,20 @@ cask "cockatrice" do
homepage "https://cockatrice.github.io/"
livecheck do
url :url
strategy :github_latest do |page|
match = page.match(
%r{href=".*?/(\d+(?:-\d+)+)-Release-(\d+(?:\.\d+)+)/Cockatrice-([^/]+)-\2-macOS-[.\w]*\.dmg"}i,
url "https://github.com/Cockatrice/Cockatrice/releases/latest/"
regex(%r{href=".*?/(\d+(?:-\d+)+)-Release-(\d+(?:\.\d+)+)/Cockatrice-([^/]+)-\2-macOS-[.\w]*\.dmg"}i)
strategy :header_match do |headers, regex|
next if headers["location"].blank?
# Identify the latest tag from the response's `location` header
latest_tag = File.basename(headers["location"])
next if latest_tag.blank?
# Fetch the assets list HTML for the latest tag and match within it
assets_page = Homebrew::Livecheck::Strategy.page_content(
@url.sub(%r{/releases/?.+}, "/releases/expanded_assets/#{latest_tag}"),
)
"#{match[2]},#{match[1]},#{match[3]}"
assets_page[:content]&.scan(regex)&.map { |match| "#{match[1]},#{match[0]},#{match[2]}" }
end
end