-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.ps1
More file actions
125 lines (94 loc) · 3.77 KB
/
Copy pathinstall.ps1
File metadata and controls
125 lines (94 loc) · 3.77 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
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
Param([switch]$Font)
$Urls = @(
"https://github.com/tree-sitter/tree-sitter/releases/download/v0.26.7/tree-sitter-cli-windows-x64.zip",
"https://github.com/jesseduffield/lazygit/releases/download/v0.60.0/lazygit_0.60.0_windows_x86_64.zip",
"https://github.com/junegunn/fzf/releases/download/v0.70.0/fzf-0.70.0-windows_amd64.zip",
"https://github.com/sharkdp/fd/releases/download/v10.4.2/fd-v10.4.2-x86_64-pc-windows-msvc.zip",
"https://github.com/BurntSushi/ripgrep/releases/download/15.1.0/ripgrep-15.1.0-x86_64-pc-windows-msvc.zip",
"https://github.com/neovim/neovim/releases/download/nightly/nvim-win64.zip"
)
$alacrittyURL = "https://github.com/alacritty/alacritty/releases/download/v0.16.1/Alacritty-v0.16.1-portable.exe"
$nerdFontsURL = "https://github.com/ryanoasis/nerd-fonts/releases/download/v3.4.0/0xProto.zip"
$rootDirectory = (Get-location).Path
$tempDirectory = Join-Path -Path $rootDirectory -ChildPath "tmp"
$binariesDirectory = Join-Path -Path $rootDirectory -ChildPath "bin"
Write-output ("Verifying URLS...")
foreach ($url in $Urls) {
try {
$response = curl -Uri $url -UseBasicParsing -Method Head -TimeoutSec 10
if ($response.StatusCode -ge 200 -and $response.StatusCode -lt 400) {
Write-Host "$url is valid (Status: $($response.StatusCode))"
} else {
Write-Host "$url returned status $($response.StatusCode)"
}
}
catch {
Write-Host "$url is NOT reachable"
throw "Invalid URL please verify broken URL"
}
}
Write-output ("downloading files from URLs...")
New-Item -ItemType Directory -Force -Path $tempDirectory | Out-Null
New-Item -ItemType Directory -Force -Path $binariesDirectory | Out-Null
foreach ($url in $Urls) {
try {
Write-output "Downloading file....$url"
$filename = Split-Path -Path $url -Leaf
Invoke-WebRequest -Uri $url -OutFile (Join-Path -Path $tempDirectory -ChildPath $filename)
}
catch {
throw "Error trying to download the file: $_"
}
}
Write-output "Download complete..."
Write-output "Trying to unzip the files..."
$zipFiles = Get-ChildItem -Path $tempDirectory -Filter *.zip
foreach ($zip in $zipFiles) {
$extractPath = Join-Path -Path $tempDirectory -ChildPath $zip.BaseName
Expand-Archive -Path $zip.FullName -DestinationPath $extractPath
# Find all EXE files inside extracted content
$exe = Get-ChildItem -Path $extractPath -Recurse -Filter *.exe
if ($zip.BaseName -match "nvim-win64")
{
Move-Item -Path $extractPath -Destination $rootDirectory
Write-output "neovim"
}
else
{
Move-Item -Path $exe.FullName -Destination $binariesDirectory
}
}
Write-output "Unpacking zips done!"
Write-output "Clonning config files to appdata...."
# After that clone the nvim configuration onto the $env:LOCALAPPDATA
git clone https://github.com/guest-fgx4/nvim-config.git $env:LOCALAPPDATA/nvim
Write-output "Finished cloning config files!"
# Download Alacritty term portable binary
Write-output "Downloading Alacritty term...."
try
{
Invoke-WebRequest -Uri $alacrittyURL -OutFile (Join-Path -Path $rootDirectory -ChildPath "alacritty.exe")
}
catch
{
Write-output "Something went wrong downloading alacritty! $_"
}
if ($Font)
{
Write-output "Downloading Nerd Fonts term...."
try
{
$filename = Join-Path -Path $tempDirectory -ChildPath "fonts.zip"
Invoke-WebRequest -Uri $nerdFontsURL -OutFile $filename
}
catch
{
Write-output "Something went wrong downloading the fonts! $_"
}
Expand-Archive -Path $filename -DestinationPath (Join-Path -Path $tempDirectory -ChildPath "Fonts")
#install the regular font
}
# Try and insert the nvim path and binary path onto powershell path automatically at start up
#
Write-output "Cleaning up tmp files..."
Remove-Item -Path $tempDirectory -Recurse