pspm.psm1

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
#Requires -Version 4

$modulePath = $PSScriptRoot
$classPath = '/Class'
$functionsPath = '/functions'

#region Enable TLS1.2 in the current session (if not supported)
if (([Net.ServicePointManager]::SecurityProtocol -ne [Net.SecurityProtocolType]::SystemDefault) -and (-not ([Net.ServicePointManager]::SecurityProtocol -band [Net.SecurityProtocolType]::Tls12))) {
    [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
    Write-Verbose ('TLS 1.2 is enabled in the current session')
}
#endregion

#region Load Class Libraries
$DllList = @(
    '/bin/SemVer.dll'
)

$DllList | ForEach-Object {
    Add-Type -Path (Join-Path (Join-Path $modulePath $classPath) $_)
}
#endregion Load Class Libraries

#region Load functions
$FunctionList = @(
    'Test-IsWindows.ps1'
    'Test-AdminPrivilege.ps1'
    'Format-Json.ps1'
    'Get-PackageJson.ps1'
    'Get-PSModulePath.ps1'
    'Get-ModuleInfo.ps1'
    'GitHubUtils.ps1'
    'getModule.ps1'
    'pspm.ps1'
)

$FunctionList | ForEach-Object {
    . (Join-Path (Join-Path $modulePath $functionsPath) $_)
}
#endregion Load functions

& (Join-Path (Join-Path $modulePath $functionsPath) 'Test-PowerShellGetVersion.ps1')

Export-ModuleMember -Function pspm