-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
/
Copy pathtemurin.rb
33 lines (26 loc) · 1.34 KB
/
temurin.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
cask "temurin" do
arch = Hardware::CPU.intel? ? "x64" : "aarch64"
version "17.0.2,8"
if Hardware::CPU.intel?
sha256 "b82d3ba3ff4c453bd954979a20e67754478294da8650e3b9e50f6d1a7cf5c628"
else
sha256 "0904c11eb5f7b53aac53e6279992ee2a900c9517b26659dee3704b2d11c149cd"
end
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/info/release_versions?release_type=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"
strategy :page_match do |page|
JSON.parse(page)["versions"].map do |version|
match = version["openjdk_version"].match(/^(\d+(?:\.\d+)*)\+(\d+(?:\.\d+)*)$/i)
next if match.blank?
"#{match[1]},#{match[2]}"
end.compact
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"
end