cask "temurin@17" do arch arm: "aarch64", intel: "x64" version "17.0.15,6" sha256 arm: "95f743c1bd7baf7f7d306ed76169f748a4bafe910e305c6097a093e2bcad126e", intel: "28a0712a65a2862ba2a2e51fd8f479f12c0921acfbfc6dba08f6ed6c69a2902a" url "https://github.com/adoptium/temurin#{version.major}-binaries/releases/download/jdk-#{version.csv.first}%2B#{version.csv.second}/OpenJDK#{version.major}U-jdk_#{arch}_mac_hotspot_#{version.csv.first}_#{version.csv.second.major}.pkg", verified: "github.com/adoptium/" name "Eclipse Temurin Java Development Kit" desc "JDK from the Eclipse Foundation (Adoptium)" homepage "https://adoptium.net/" livecheck do url "https://api.adoptium.net/v3/assets/feature_releases/#{version.major}/ga?architecture=#{arch}&image_type=jdk&jvm_impl=hotspot&os=mac&page=0&page_size=1&project=jdk&sort_method=DEFAULT&sort_order=DESC&vendor=eclipse" regex(/^jdk-(\d+(?:\.\d+)+)\+(\d+(?:\.\d+)*)$/i) strategy :json do |json, regex| json.map do |release| match = release["release_name"]&.match(regex) next if match.blank? "#{match[1]},#{match[2]}" end end end pkg "OpenJDK#{version.major}U-jdk_#{arch}_mac_hotspot_#{version.csv.first}_#{version.csv.second.major}.pkg" uninstall pkgutil: "net.temurin.#{version.major}.jdk" # No zap stanza required end