-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_bootstrap.ps1
More file actions
43 lines (35 loc) · 1.24 KB
/
_bootstrap.ps1
File metadata and controls
43 lines (35 loc) · 1.24 KB
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
33
34
35
36
37
38
39
40
41
42
43
Using namespace System.Collections.Generic
Using namespace System.Diagnostics.CodeAnalysis
Using namespace System.Management.Automation
[SuppressMessageAttribute('PSUseCompatibleCmdlets', '', Target = 'Install-Module', Justification = 'Go home, PSScriptAnalyzer. You are drunk.')]
Param()
#region declarations
[List[String]]$requiredModuleList = @(
'InvokeBuild'
'ModuleBuilder'
'Pester',
'PlatyPS'
)
[List[PSCustomObject]]$requiredToolInfo = @(
[PSCustomObject]@{
Name = 'GitTools.GitVersion'
Path = "$env:LocalAppData\Microsoft\WinGet\Plackages\GitTools.GitVersion_Microsoft.Winget.Source_8wekyb3d8bbwe\gitversion.exe"
}
)
#endregion declarations
#region functions
function Install-WinGetApp {
Param([Parameter(Mandatory, ValueFromPipeline)][String[]]$Name)
Process { Foreach ($n in $Name) { & winget install --exact --id $n --scope user --source winget --accept-package-agreements } }
}
#endregion functions
#region logic
Foreach ($m in $requiredModuleList) {
If (-not (Get-Module -ListAvailable -Name $m)) {
Install-Module -Force -Repository PSGallery -Name $m
}
}
Foreach ($t in $requiredToolInfo) {
If (-not (Test-Path -Path $t.Path)) {Install-WinGetApp -Name $t.Name}
}
#endregion logic