|
1 | 1 | param
|
2 | 2 | (
|
3 | 3 | [string]
|
4 |
| - $DependencyPath = (Resolve-Path "$PSScriptRoot\requiredModules.psd1").Path |
| 4 | + $DependencyPath = (Resolve-Path "$PSScriptRoot\requiredModules.psd1").Path, |
| 5 | + |
| 6 | + [switch] |
| 7 | + $BuildWorker |
5 | 8 | )
|
6 | 9 |
|
7 | 10 | $psdependConfig = Import-PowerShellDataFile -Path $DependencyPath
|
8 | 11 |
|
9 |
| -$null = Get-PackageProvider -Name NuGet -ForceBootstrap |
| 12 | +if ($BuildWorker.IsPresent) |
| 13 | +{ |
| 14 | + $null = Get-PackageProvider -Name NuGet -ForceBootstrap |
10 | 15 |
|
11 |
| -Save-Module -Name PackageManagement, PowerShellGet, PSDepend -Repository $psdependConfig.PSDependOptions.Parameters.Repository -Path $psdependConfig.PSDependOptions.Target -Force |
| 16 | + Install-Module -Force -Name PackageManagement, PowerShellGet -Repository $psdependConfig.PSDependOptions.Parameters.Repository -Scope CurrentUser |
12 | 17 |
|
13 |
| -Remove-Module -Name PowerShellGet -ErrorAction SilentlyContinue -Force |
14 |
| -Remove-Module -Name PackageManagement -ErrorAction SilentlyContinue -Force |
15 |
| -Import-Module -Force -Name (Join-Path -Path $psdependConfig.PSDependOptions.Target -ChildPath PackageManagement\*\PackageManagement.psd1 -Resolve) |
16 |
| -Import-Module -Force -Name (Join-Path -Path $psdependConfig.PSDependOptions.Target -ChildPath PowerShellGet\*\PowerShellGet.psd1 -Resolve) |
17 |
| -Import-Module -Name (Join-Path -Path $psdependConfig.PSDependOptions.Target -ChildPath PSDepend\*\PSDepend.psd1 -Resolve) |
| 18 | + Remove-Module -Name PowerShellGet -ErrorAction SilentlyContinue -Force |
| 19 | + Remove-Module -Name PackageManagement -ErrorAction SilentlyContinue -Force |
| 20 | + Import-Module -Force -Name PowerShellGet |
| 21 | + Import-Module -Force -Name PackageManagement |
18 | 22 |
|
| 23 | + $null = Install-WindowsFeature -Name GPMC |
| 24 | +} |
| 25 | + |
| 26 | +Save-Module -Name PSDepend -Repository $psdependConfig.PSDependOptions.Parameters.Repository -Path $psdependConfig.PSDependOptions.Target -Force |
| 27 | +Import-Module -Name (Join-Path -Path $psdependConfig.PSDependOptions.Target -ChildPath PSDepend\*\PSDepend.psd1 -Resolve) |
19 | 28 | Invoke-PSDepend -Path $DependencyPath -Force
|
0 commit comments