-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.ps1
More file actions
27 lines (20 loc) · 1.01 KB
/
install.ps1
File metadata and controls
27 lines (20 loc) · 1.01 KB
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
$ErrorActionPreference = "Stop"
$Repo = "monzeromer-lab/WebFluent"
$InstallDir = if ($env:WF_INSTALL_DIR) { $env:WF_INSTALL_DIR } else { "$env:USERPROFILE\.webfluent\bin" }
$Target = "x86_64-pc-windows-msvc"
$Release = Invoke-RestMethod "https://api.github.com/repos/$Repo/releases/latest"
$Version = $Release.tag_name
$Url = "https://github.com/$Repo/releases/download/$Version/wf-$Version-$Target.zip"
$TmpZip = "$env:TEMP\wf.zip"
Write-Host "Installing wf $Version..."
New-Item -ItemType Directory -Force -Path $InstallDir | Out-Null
Invoke-WebRequest -Uri $Url -OutFile $TmpZip
Expand-Archive -Path $TmpZip -DestinationPath $InstallDir -Force
Remove-Item $TmpZip
# Add to PATH if not already there
$UserPath = [Environment]::GetEnvironmentVariable("Path", "User")
if ($UserPath -notlike "*$InstallDir*") {
[Environment]::SetEnvironmentVariable("Path", "$InstallDir;$UserPath", "User")
Write-Host "Added $InstallDir to user PATH (restart terminal to take effect)"
}
Write-Host "Done! Run 'wf --help' to get started."