-
Notifications
You must be signed in to change notification settings - Fork 4
/
jabbaw.ps1
31 lines (23 loc) · 1.09 KB
/
jabbaw.ps1
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
$ErrorActionPreference = "Stop"
$jabbaHome = if ($env:JABBA_HOME) { $env:JABBA_HOME } else { if ($env:JABBA_DIR) { $env:JABBA_DIR } else { "$env:USERPROFILE\.jabba" } }
$jabbaVersion = if ($env:JABBA_VERSION) { $env:JABBA_VERSION } else { "latest" }
if ($jabbaVersion -eq "latest") {
# resolving "latest" to an actual tag
$jabbaVersion = (Invoke-RestMethod https://api.github.com/repos/Jabba-Team/jabba/releases/latest).body
}
$ErrorActionPreference = "SilentlyContinue"
& $jabbaHome\bin\jabba.exe --version | Out-Null
$binaryValid = $?
$ErrorActionPreference = "Continue"
if ($binaryValid) {
$realVersion = Invoke-Expression "$jabbaHome\bin\jabba.exe --version"
}
if (-not $binaryValid -or $jabbaVersion -ne $realVersion) {
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-Expression (
Invoke-WebRequest https://github.com/Jabba-Team/jabba/raw/main/install.ps1 -UseBasicParsing
).Content
}
Invoke-Expression "$jabbaHome\bin\jabba.exe install"
$env:JAVA_HOME = Invoke-Expression "$jabbaHome\bin\jabba.exe which --home"
Invoke-Expression "& $args"