-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path00_get_code.ps1
25 lines (20 loc) · 876 Bytes
/
00_get_code.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
Function Get-Repository($Location, $Destination) {
$Url = "https://api.github.com/repos/$Location/tarball/master"
Write-Host "Downloading and extracting from $Url to $Destination"
# cleanup
Remove-Item -Recurse -Force $Destination -ErrorAction Ignore
New-Item -Name $Destination -ItemType "directory" | Out-Null
# download and extract
$DownloadLocation = New-TemporaryFile
Invoke-WebRequest -Uri $Url -OutFile $DownloadLocation
tar -xzf $DownloadLocation -C $Destination
# fix directory layout
$extractedName = Get-ChildItem -Path $Destination -Name | Select-Object -first 1
Move-Item "$Destination\$extractedName\*" $Destination
Remove-Item "$Destination\$extractedName"
}
Function Main() {
Get-Repository "ghdl/ghdl" "build\ghdl"
Get-Repository "ghdl/ghdl-language-server" "build\ghdl-language-server"
}
Main