-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
/
dotnet-sdk.rb
56 lines (49 loc) · 1.92 KB
/
dotnet-sdk.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
cask "dotnet-sdk" do
arch arm: "arm64", intel: "x64"
on_arm do
version "9.0.101,00630dd1-1470-4f65-9238-a9262d170a29,86e0e51d908e9b12b017423c2f915998"
sha256 "8ba374f99e79ca0bcf9312e803ea1f8888e963830b0a3786758f2fe9e34ddf5c"
end
on_intel do
version "9.0.101,1fec6f64-0d7f-4b39-acd1-e9e2701a6b1d,b7b6246d0c20cfe703c6c88ffdbb081e"
sha256 "4ca38ac2882cae8f69d686a9442bf89232fe9808654f68ad0f72e13d72741787"
end
url "https://download.visualstudio.microsoft.com/download/pr/#{version.csv.second}/#{version.csv.third}/dotnet-sdk-#{version.csv.first}-osx-#{arch}.pkg"
name ".NET SDK"
desc "Developer platform"
homepage "https://www.microsoft.com/net/core#macos"
# This identifies releases with the same major/minor version as the current
# cask version. New major/minor releases occur annually in November and the
# check will automatically update its behavior when the cask is updated.
livecheck do
url "https://builds.dotnet.microsoft.com/dotnet/release-metadata/#{version.major_minor}/releases.json"
regex(%r{/download/pr/([^/]+)/([^/]+)/dotnet-sdk[._-]v?(\d+(?:\.\d+)+)[._-]osx[._-]#{arch}\.pkg}i)
strategy :json do |json, regex|
json["releases"]&.map do |release|
release.dig("sdk", "files")&.map do |file|
file["url"]&.scan(regex)&.map { |match| "#{match[2]},#{match[0]},#{match[1]}" }
end
end&.flatten
end
end
conflicts_with cask: [
"dotnet",
"dotnet-sdk@preview",
"dotnet@preview",
], formula: "dotnet"
depends_on macos: ">= :mojave"
pkg "dotnet-sdk-#{version.csv.first}-osx-#{arch}.pkg"
binary "/usr/local/share/dotnet/dotnet"
uninstall pkgutil: [
"com.microsoft.dotnet.*",
"com.microsoft.netstandard.pack.targeting.*",
],
delete: [
"/etc/paths.d/dotnet",
"/etc/paths.d/dotnet-cli-tools",
]
zap trash: [
"~/.dotnet",
"~/.nuget",
]
end