Skip to content

Commit

Permalink
More ap_download script updates
Browse files Browse the repository at this point in the history
Now requires Powershell V6
  • Loading branch information
atruskie committed May 9, 2019
1 parent 7dc4f0e commit 6973fd5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions build/download_ap.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ Describe 'AP.exe installer script' {
$result.AssetUrl | Should -BeLike '*github.com*'
}
It 'can download a build from AppVeyor' {
$result = Invoke -ci_build_number 678 -WhatIf
$result = Invoke -ci_build_number 730 -WhatIf
$result.Type | Should -Be "AppVeyor"
$result.Source | Should -Be "appveyor"
$result.ResolvedVersion | Should -Be '678'
$result.ResolvedVersion | Should -Be '730'
$result.AssetUrl | Should -BeLike '*appveyor.com*'
}
}
Expand Down
6 changes: 3 additions & 3 deletions build/download_ap.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/pwsh

#Requires -Version 5
#Requires -Version 6

# .SYNOPSIS
# Downloads and "installs" (or updates) AP.exe
Expand Down Expand Up @@ -194,7 +194,7 @@ Write-Output "Downloading asset $asset_url"
$downloaded_zip = "$destination/AP.zip"
if ($PsCmdlet.ShouldProcess($asset_url, "Downloading asset")) {
# use curl if available (faster)
$curl = Get-Command curl, curl.exe -CommandType Application -ErrorAction SilentlyContinue | select -First 1
$curl = Get-Command curl, curl.exe -CommandType Application -ErrorAction SilentlyContinue | Select-Object -First 1
if ($curl) {
& $curl -L -o "$downloaded_zip" "$asset_url"

Expand Down Expand Up @@ -238,7 +238,7 @@ if ($IsWin) {
$paths = $paths | Where-Object { $_ }
$paths += $destination
$user_path = ($paths -join [IO.Path]::PathSeparator)
if ($PsCmdlet.ShouldProcess("PATH", "Adding $destionation to PATH")) {
if ($PsCmdlet.ShouldProcess("PATH", "Adding $destination to PATH")) {
[Environment]::SetEnvironmentVariable("Path", $user_path, "User")
# this change to so that the process env vars have access
$env:Path += ([IO.Path]::PathSeparator + $destination)
Expand Down

0 comments on commit 6973fd5

Please sign in to comment.