From c6c036cb45f840e6ef1a4af4b654a06f92cb9e50 Mon Sep 17 00:00:00 2001 From: Sam Ford <1584702+samford@users.noreply.github.com> Date: Fri, 29 Sep 2023 23:57:46 -0400 Subject: [PATCH] s/stoplight-studio: update livecheck --- Casks/s/stoplight-studio.rb | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Casks/s/stoplight-studio.rb b/Casks/s/stoplight-studio.rb index 7f2fc175922..700f3aa517c 100644 --- a/Casks/s/stoplight-studio.rb +++ b/Casks/s/stoplight-studio.rb @@ -12,10 +12,15 @@ cask "stoplight-studio" do homepage "https://stoplight.io/studio/" livecheck do - url "https://github.com/stoplightio/studio/releases/latest" - regex(%r{href=.*?/v?(\d+(?:\.\d+)+)[._-]stable[._-]([^/]+)/stoplight[._-]studio[._-]#{arch}\.dmg}i) - strategy :page_match do |page, regex| - page.scan(regex).map { |match| "#{match[0]},#{match[1]}" } + url :url + regex(%r{/v?(\d+(?:\.\d+)+)[._-]stable[._-]([^/]+)/stoplight[._-]studio[._-]#{arch}\.dmg$}i) + strategy :github_latest do |json, regex| + json["assets"]&.map do |asset| + match = asset["browser_download_url"]&.match(regex) + next if match.blank? + + "#{match[1]},#{match[2]}" + end end end