-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.ps1
More file actions
58 lines (48 loc) · 1.75 KB
/
install.ps1
File metadata and controls
58 lines (48 loc) · 1.75 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
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
param (
[string]$Version
)
# Set target filename and GitHub repo
$target = "vedic-win-x86_64.zip"
$repo = "https://github.com/vedic-lang/vedic"
# Determine download URL
if (-not $Version) {
$url = "$repo/releases/latest/download/$target"
} else {
$url = "$repo/releases/download/$Version/$target"
}
# Define install directory
$home = [Environment]::GetFolderPath("UserProfile")
$installDir = Join-Path $home ".vedic"
$zipPath = Join-Path $installDir "vedic.zip"
$exePath = Join-Path $installDir "vedic.exe"
# Create install directory if it doesn't exist
if (-not (Test-Path $installDir)) {
New-Item -ItemType Directory -Path $installDir | Out-Null
}
# Download the Vedic ZIP
Write-Host "📥 Downloading Vedic from: $url"
Invoke-WebRequest -Uri $url -OutFile $zipPath -UseBasicParsing
# Extract the ZIP
Write-Host "📦 Extracting Vedic to $installDir"
Add-Type -AssemblyName System.IO.Compression.FileSystem
[System.IO.Compression.ZipFile]::ExtractToDirectory($zipPath, $installDir, $true)
# Remove the ZIP
Remove-Item $zipPath
# Set environment variable
[System.Environment]::SetEnvironmentVariable("VEDIC_INSTALL", $installDir, "User")
# Add to PATH if not already added
$envPath = [System.Environment]::GetEnvironmentVariable("Path", "User")
if ($envPath -notlike "*$installDir*") {
[System.Environment]::SetEnvironmentVariable("Path", "$envPath;$installDir", "User")
Write-Host "✅ Added $installDir to your PATH"
} else {
Write-Host "ℹ️ $installDir is already in PATH"
}
# Verify installation
$vedicCmd = Join-Path $installDir "vedic.exe"
if (Test-Path $vedicCmd) {
Write-Host "🎉 Vedic installed successfully at: $vedicCmd"
& $vedicCmd --help
} else {
Write-Host "❌ Installation failed: vedic.exe not found in $installDir"
}