-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.ps1
More file actions
47 lines (42 loc) · 1.31 KB
/
main.ps1
File metadata and controls
47 lines (42 loc) · 1.31 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
44
45
46
47
#Requires -Modules GitHub
[CmdletBinding()]
param()
$requiredModules = @{
Utilities = @{}
Retry = @{}
'powershell-yaml' = @{}
PSSemVer = @{}
Pester = @{}
PSScriptAnalyzer = @{}
PlatyPS = @{}
MarkdownPS = @{}
Hashtable = @{}
# 'Microsoft.PowerShell.PlatyPS' = @{
# Prerelease = $true
# }
}
$requiredModules.GetEnumerator() | Sort-Object | ForEach-Object {
$name = $_.Key
$settings = $_.Value
LogGroup "Installing prerequisite: [$name]" {
$Count = 5
$Delay = 10
for ($i = 1; $i -le $Count; $i++) {
try {
Install-PSResource -Name $name -TrustRepository -Repository PSGallery @settings
break
} catch {
if ($i -eq $Count) {
throw $_
}
Start-Sleep -Seconds $Delay
}
}
Write-Output "Installed module: [$name]"
Get-PSResource -Name $name | Select-Object * | Out-String
Write-Output 'Module commands:'
Get-Command -Module $name | Out-String
}
}
Get-InstalledPSResource -Verbose:$false | Sort-Object -Property Name |
Format-Table -Property Name, Version, Prerelease, Repository -AutoSize | Out-String