forked from anshulagrawal07/sfsnowsightextensions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Download-SFBinaries.ps1
29 lines (21 loc) · 1.49 KB
/
Download-SFBinaries.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
26
27
28
29
$version_number = Read-Host -Prompt "`r`nWhat version of the binaries do you want to install? (Hit enter to get the latest binaries)"
if ($version_number -eq ''){
Write-Host "`r`nSearching https://api.github.com/repos/Snowflake-Labs/sfsnowsightextensions/releases/latest for latest binaries...`r`n" -ForegroundColor Cyan
$requestData = Invoke-WebRequest -Uri "https://api.github.com/repos/Snowflake-Labs/sfsnowsightextensions/releases/latest"
$releases = ConvertFrom-Json $requestData.content
$version_number = $releases.tag_name
Write-Host "Found latest release: $version_number`r`n" -ForegroundColor Cyan
}
Do { $os = Read-Host -Prompt "Which os are you downloading the binaries for? Use osx, win, or linux" }
while ('osx', 'win', 'linux' -notcontains $os )
if ($os -eq 'win'){
$download_path = "$home/Downloads"
}
else {
$download_path = '~/Downloads'
}
Write-Host "`r`nAttempting to download file if it exists at https://github.com/Snowflake-Labs/sfsnowsightextensions/releases/download/$version_number/SnowflakePS.$os.$version_number.zip`r`n" -ForegroundColor Cyan
curl "https://github.com/Snowflake-Labs/sfsnowsightextensions/releases/download/$version_number/SnowflakePS.$os.$version_number.zip" -O --output-dir ~/Downloads -o -J -Lclear
Expand-Archive "$download_path/SnowflakePS.$os.$version_number.zip" -DestinationPath "~/Downloads" -Force
Import-Module "$download_path/SnowflakePS.$os.$version_number/SnowflakePS.psd1" -Force -Verbose -Global
Get-Command -Module SnowflakePS