From 7c6bfab8fa2ffd2cf090d85a0fdf23d69b9bcac0 Mon Sep 17 00:00:00 2001 From: Aaron Jensen Date: Fri, 17 Feb 2023 16:48:46 -0800 Subject: [PATCH] Using latest build pattern so Prism gets installed. --- appveyor.yml | 14 ++++++++++---- init.ps1 | 41 ----------------------------------------- 2 files changed, 10 insertions(+), 45 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 27ec8f43..ff34c359 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -53,13 +53,19 @@ for: only: - job_group: ps build_script: - - ps: .\init.ps1 -SqlServerName "$($env:MSSQL_INSTANCE_NAME)" - - ps: .\build.ps1 + - ps: | + $ProgressPreference = 'SilentlyContinue' + iwr https://raw.githubusercontent.com/webmd-health-services/Prism/main/Scripts/init.ps1 | iex | Format-Table + .\init.ps1 -SqlServerName "$($env:MSSQL_INSTANCE_NAME)" + .\build.ps1 # Build in PowerShell - matrix: only: - job_group: pwsh build_script: - - pwsh: ./init.ps1 -SqlServerName "$($env:MSSQL_INSTANCE_NAME)" - - pwsh: ./build.ps1 \ No newline at end of file + - pwsh: | + $ProgressPreference = 'SilentlyContinue' + iwr https://raw.githubusercontent.com/webmd-health-services/Prism/main/Scripts/init.ps1 | iex | Format-Table + ./init.ps1 -SqlServerName "$($env:MSSQL_INSTANCE_NAME)" + ./build.ps1 diff --git a/init.ps1 b/init.ps1 index 15d29c41..90c56caf 100644 --- a/init.ps1 +++ b/init.ps1 @@ -14,44 +14,3 @@ Set-StrictMode -Version 'Latest' $InformationPreference = 'Continue' $SqlServerName | Set-Content -Path 'Test\Server.txt' - -# Run in a background job so that old PackageManagement assemblies don't get loaded. -$job = Start-Job { - $InformationPreference = 'Continue' - $psGalleryRepo = Get-PSRepository -Name 'PSGallery' - $repoToUse = $psGalleryRepo.Name - # On Windows 2012 R2, Windows PowerShell 5.1, and .NET 4.6.2, PSGallery's URL ends with a '/'. - if( -not $psGalleryRepo -or $psgalleryRepo.SourceLocation -ne 'https://www.powershellgallery.com/api/v2' ) - { - $repoToUse = 'PSGallery2' - Register-PSRepository -Name $repoToUse ` - -InstallationPolicy Trusted ` - -SourceLocation 'https://www.powershellgallery.com/api/v2' ` - -PackageManagementProvider $psGalleryRepo.PackageManagementProvider - } - - Write-Information -MessageData 'Installing latest version of PowerShell module Prism.' - Install-Module -Name 'Prism' -Scope CurrentUser -Repository $repoToUse -AllowClobber -Force - - if( -not (Get-Module -Name 'PackageManagement' -ListAvailable | Where-Object 'Version' -eq '1.4.7') ) - { - Write-Information -MessageData 'Installing PowerShell module PackageManagement 1.4.7.' - Install-Module -Name 'PackageManagement' -RequiredVersion '1.4.7'-Repository $repoToUse -AllowClobber -Force - } - - if( -not (Get-Module -Name 'PowerShellGet' -ListAvailable | Where-Object 'Version' -eq '2.2.5') ) - { - Write-Information -MessageData 'Installing PowerShell module PowerShellGet 2.2.5.' - Install-Module -Name 'PowerShellGet' -RequiredVersion '2.2.5' -Repository $repoToUse -AllowClobber -Force - } -} - -if( (Get-Command -Name 'Receive-Job' -ParameterName 'AutoRemoveJob') ) -{ - $job | Receive-Job -AutoRemoveJob -Wait -} -else -{ - $job | Wait-Job | Receive-Job - $job | Remove-Job -}