cask "oracle-jdk-javadoc" do version "21.0.5,9,2c362a07c29148c48a2ea7299a192e5d" sha256 "81e6658f5ce2d038090026c5b58b53528ba2c45d1b25f97411a39b1d7d5e8924" url "https://download.oracle.com/otn_software/java/jdk/#{version.csv.first}+#{version.csv.second}/#{version.csv.third}/jdk-#{version.csv.first}_doc-all.zip", cookies: { "oraclelicense" => "accept-securebackup-cookie", } name "Oracle Java Standard Edition Development Kit Documentation" desc "Documentation for the Oracle JDK" homepage "https://www.oracle.com/java/technologies/downloads/" livecheck do url "https://www.oracle.com/java/technologies/javase-jdk#{version.major}-doc-downloads.html" regex(%r{/(\d+(?:\.\d+)*)(?:\+|%2B)(\d+(?:\.\d+)*)/(\h+)/jdk[._-]v?(\d+(?:\.\d+)*)_doc-all\.zip}i) strategy :page_match do |page, regex| page.scan(regex).map { |match| "#{match[0]},#{match[1]},#{match[2]}" } end end artifact "docs", target: "/Library/Java/JavaVirtualMachines/jdk-#{version.major}.jdk/Contents/Home/docs" uninstall rmdir: "/Library/Java/JavaVirtualMachines/jdk-#{version.major}.jdk" # No zap stanza required caveats do license "https://download.oracle.com/otndocs/jcp/java_se-#{version.major}-final-spec/license.html" end end