-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinitialize.ps1
More file actions
32 lines (30 loc) · 951 Bytes
/
Copy pathinitialize.ps1
File metadata and controls
32 lines (30 loc) · 951 Bytes
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
30
31
32
#Requires -Version 7.0
<#
.SYNOPSIS
Bootstraps a fresh clone so build, test, and pack can run.
.DESCRIPTION
Installs the PowerShell modules this repository needs if they are missing (Pester for the
tests, powershell-yaml for the index validator). Safe to run repeatedly.
.PARAMETER SkipTools
Do not install missing modules; only report them.
.EXAMPLE
./initialize.ps1
#>
[CmdletBinding()]
param(
[Parameter()]
[switch]$SkipTools
)
$ErrorActionPreference = 'Stop'
foreach ($name in 'Pester', 'powershell-yaml') {
if (Get-Module -ListAvailable -Name $name) {
Write-Host " $name present" -ForegroundColor Green
continue
}
if ($SkipTools) {
Write-Host " $name missing; run without -SkipTools to install it" -ForegroundColor Yellow
continue
}
Write-Host " installing $name" -ForegroundColor Yellow
Install-Module $name -Scope CurrentUser -Force -SkipPublisherCheck
}