cask "temurin@21" do arch arm: "aarch64", intel: "x64" version "21.0.5,11" sha256 arm: "f71e5d937631e3f7225c44635499449ad35719621128eb8cc377b8453053e634", intel: "2fd0c01e745b80fd30a5312a0fcc4449b59075ac1c199ef23360673142f51a36" 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 21" 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+)*)(?:-LTS)?$/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