From 67dfbc958966d528d2ebb97a91cc175f5b80bf6b Mon Sep 17 00:00:00 2001 From: Klaus Hipp Date: Fri, 27 Dec 2024 12:37:00 +0100 Subject: [PATCH] parallels-client: update livecheck --- Casks/p/parallels-client.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Casks/p/parallels-client.rb b/Casks/p/parallels-client.rb index 6ae14c0a6ea0..321637db131e 100644 --- a/Casks/p/parallels-client.rb +++ b/Casks/p/parallels-client.rb @@ -11,10 +11,13 @@ url "https://download.parallels.com/website_links/ras/#{version.csv.first.major}/builds-en_US.json" regex(/RasClient[._-]Mac[._-]Notarized[._-]v?(\d+(?:\.\d+)+)[._-](\d+)\.pkg/i) strategy :json do |json, regex| - client_json = json.select { |item| item.dig("category", "name")&.start_with?("Client") }&.first - mac_client_json = client_json&.dig("contents")&.select { |item| item["subcategory"] == "Mac" }&.first - download_url = mac_client_json&.dig("files", "Mac Client") - match = download_url&.match(regex) + client_json = json.find { |item| item.dig("category", "name")&.start_with?("Client") } + next if client_json.blank? + + mac_client_json = client_json["contents"]&.find { |item| item["subcategory"] == "Mac" } + next if mac_client_json.blank? + + match = mac_client_json.dig("files", "Mac Client")&.match(regex) next if match.blank? "#{match[1]},#{match[2]}"