-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_javalings.ps1
86 lines (70 loc) · 3 KB
/
install_javalings.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
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/usr/bin/env pwsh
Write-Host "Let's get you set up with Javaligns!" -ForegroundColor DarkCyan;
Write-Host "`n"
Write-Host "Checking requirements..." -ForegroundColor DarkCyan;
if (Get-Command choco -ErrorAction SilentlyContinue)
{
Write-Host "SUCCESS: Chocolatey is installed" -ForegroundColor DarkCyan;
}
else
{
Write-Host "WARNING: Chocolatey does not seem to be installed." -ForegroundColor DarkCyan;
Write-Host "Installing Chocolatey package manager.." -ForegroundColor DarkCyan;
` Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
}
Write-Host "`n"
Write-Host "Refreshing environment varibales..." -ForegroundColor DarkCyan;
` refreshenv
Write-Host "`n"
Write-Host " Enabling color codes in consoles..." -ForegroundColor DarkCyan;
` Set-ItemProperty HKCU:\Console VirtualTerminalLevel -Type DWORD 1
Write-Host "Enabling auto confirmations for pre requisites installations.." -ForegroundColor DarkCyan;
` choco feature enable -n=allowGlobalConfirmation
Write-Host "`n"
if (Get-Command java -ErrorAction SilentlyContinue)
{
Write-Host "SUCCESS: Java is installed" -ForegroundColor DarkCyan;
Write-Host "Checking Java version ..." -ForegroundColor DarkCyan;
$javaVersion = (Get-Command java | Select-Object -ExpandProperty Version).toString();
if ($javaVersion.Contains("21"))
{
Write-Host "SUCCESS: Java $javaVersion is installed" -ForegroundColor DarkCyan;
}
else
{
Write-Host "ERROR: Recommended java version is 21" -ForegroundColor Red;
Write-Host "ERROR: Javalings needs a higher java version." -ForegroundColor Red;
exit 1
}
}
else
{
Write-Host "WARNING: Java does not seem to be installed." -ForegroundColor DarkCyan;
Write-Host "Installing OpenJDK 21..." -ForegroundColor DarkCyan;
` choco install openjdk --version=21.0.0
}
Write-Host "`n"
if (Get-Command git -ErrorAction SilentlyContinue)
{
Write-Host "SUCCESS: Git is installed" -ForegroundColor DarkCyan;
}
else
{
Write-Host "WARNING: Git does not seem to be installed." -ForegroundColor DarkCyan;
Write-Host "Installing Git..." -ForegroundColor DarkCyan;
` choco install git
}
Write-Host "`n"
Write-Host "Refreshing environment varibales..." -ForegroundColor DarkCyan;
` refreshenv
Write-Host "`n"
Write-Host "Disabling auto confirmations installations.." -ForegroundColor DarkCyan;
` choco feature disable -n=allowGlobalConfirmation
Write-Host "`n"
Write-Host "Cloning javalings repository..." -ForegroundColor DarkCyan;
` git clone https://github.com/oppahansi/javalings.git
Write-Host "`n"
` cd javalings/
Write-Host "All done! Run '.\javalings.bat watch' to get started." -ForegroundColor DarkCyan;
Write-Host "In case you saw any red text / errors, please make sure to rerun the install script with admin rights." -ForegroundColor Cyan;
Write-Host "`n"