-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.ps1
24 lines (18 loc) · 910 Bytes
/
install.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
# Windows installer for the Lento toolchain
$FILE_URL = "https://api.github.com/repos/lento-lang/lento/releases/latest"
FILE_NAME="lento-win.zip"
write-host "Installing Lento toolchain..." -ForegroundColor Yellow
# Download the latest release
$latest = Invoke-RestMethod -Uri $FILE_URL
$downloadUrl = $latest.assets | ? { $_.name -eq $FILE_NAME } | % { $_.browser_download_url }
Invoke-WebRequest -Uri $downloadUrl -OutFile $FILE_NAME
# Create the installation directory
$installDir = "$env:USERPROFILE/lento"
New-Item -ItemType Directory -Force -Path $installDir
Move-Item -Path $FILE_NAME -Destination $installDir
Expand-Archive -Path "$installDir/$FILE_NAME" -DestinationPath $installDir
Remove-Item -Path "$installDir/$FILE_NAME"
# Add the installation directory to the PATH
$env:Path += ";$installDir"
write-host "Installation complete!" -ForegroundColor Green
write-host "Run 'lt' to get started."