forked from Badgerati/Pode.Web
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPode.Web.psm1
More file actions
33 lines (25 loc) · 978 Bytes
/
Pode.Web.psm1
File metadata and controls
33 lines (25 loc) · 978 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
33
# root path
$root = Split-Path -Parent -Path $MyInvocation.MyCommand.Path
# load binaries
Add-Type -AssemblyName System.Web
Add-Type -AssemblyName System.Net.Http
# stop ansi colours in ps7.2+
if ($PSVersionTable.PSVersion -ge [version]'7.2.0') {
$PSStyle.OutputRendering = 'PlainText'
}
# import everything if in a runspace
if ($PODE_SCOPE_RUNSPACE) {
$sysfuncs = Get-ChildItem Function:
}
# load private functions
Get-ChildItem "$($root)/Private/*.ps1" | Resolve-Path | ForEach-Object { . $_ }
# only import public functions if not in a runspace
if (!$PODE_SCOPE_RUNSPACE) {
$sysfuncs = Get-ChildItem Function:
}
# load public functions
Get-ChildItem "$($root)/Public/*.ps1" | Resolve-Path | ForEach-Object { . $_ }
# get functions from memory and compare to existing to find new functions added
$funcs = Get-ChildItem Function: | Where-Object { $sysfuncs -notcontains $_ }
# export the module's public functions
Export-ModuleMember -Function ($funcs.Name)