|
1 | | -#kick off a background job to find |
| 1 | +#kick off a background job to find the current version of this module in the PSGallery |
2 | 2 |
|
3 | 3 | $job = Start-Job {Find-Module -name PSAutolab -Repository PSGallery } |
4 | 4 |
|
| 5 | +#dot source functions |
| 6 | +. $PSScriptRoot\functions\public.ps1 |
| 7 | +. $PSScriptRoot\functions\private.ps1 |
| 8 | + |
| 9 | +#region module check |
| 10 | +#this code should be redundant and unnecessary since the manifest specifies required Modules |
| 11 | +#but we'll keep it as a fail safe. |
| 12 | + |
5 | 13 | #declare the currently supported version of Lability |
6 | 14 | $LabilityVersion = "0.19.1" |
7 | 15 | $ConfigurationPath = Join-Path -path $PSScriptRoot -ChildPath Configurations |
8 | 16 |
|
9 | | -#dot source functions |
10 | | -. $PSScriptRoot\functions\public.ps1 |
11 | | -. $PSScriptRoot\functions\private.ps1 |
| 17 | +#declare the currently supported version of Pester |
| 18 | +#Pester v5 is incompatible with the current validation tests |
| 19 | +$PesterVersion = "4.10.1" |
12 | 20 |
|
13 | 21 | $currentLability = Get-Module -Name Lability -ListAvailable | Sort-Object -property version | Select-Object -last 1 |
14 | 22 | if ($currentLability.version -lt $LabilityVersion) { |
15 | 23 | Write-Host "You appear to be running an older version of the Lability module. Run Refresh-Host to update to version $LabilityVersion" -ForegroundColor yellow |
16 | 24 | } |
17 | 25 |
|
| 26 | +$currentPester = Get-Module -fullyqualifiedname @{ModuleName = "Pester"; ModuleVersion = "$PesterVersion"} -ListAvailable |
| 27 | +if (-not $CurrentPester) { |
| 28 | + Write-Host "You do not have the required version of the Pester module. If you have already run |
| 29 | + Setup-Host, please run Refresh-Host to install Pester version $PesterVersion. Newer versions may |
| 30 | + not be supported in this module." -ForegroundColor yellow |
| 31 | +} |
| 32 | +else { |
| 33 | + #remove any existing versions of the module. |
| 34 | + Get-Module Pester | Remove-Module |
| 35 | + #write-host "Importing Pester v$PesterVersion" -ForegroundColor green |
| 36 | + Import-Module -Name Pester -RequiredVersion $pesterVersion -global -Force |
| 37 | +} |
| 38 | +#endregion |
| 39 | + |
18 | 40 | [version]$thisVersion = (Test-ModuleManifest -path $psscriptroot\psautolab.psd1).version |
19 | 41 | $job | Wait-Job |
20 | 42 | [version]$onlineVersion = ($job | Receive-Job).version |
|
0 commit comments