-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathSampleModule.psm1
More file actions
33 lines (29 loc) · 960 Bytes
/
SampleModule.psm1
File metadata and controls
33 lines (29 loc) · 960 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
<# INSERT HEADER ABOVE #>
##Import Classes
if (Test-Path "$PSScriptRoot\Classes\classes.psd1") {
$ClassLoadOrder = Import-PowerShellDataFile -Path "$PSScriptRoot\Classes\classes.psd1" -ErrorAction SilentlyContinue
}
foreach ($class in $ClassLoadOrder.order) {
$path = '{0}\classes\{1}.ps1' -f $PSScriptRoot, $class
if (Test-Path $path) {
. $path
}
}
#Get public and private function definition files.
$Public = @( Get-ChildItem -Path $PSScriptRoot\Public\*.ps1 -ErrorAction SilentlyContinue )
$Private = @( Get-ChildItem -Path $PSScriptRoot\Private\*.ps1 -ErrorAction SilentlyContinue )
#Dot source the files
Foreach($import in @($Public + $Private))
{
Try
{
Write-Verbose "Importing $($Import.FullName)"
. $import.fullname
}
Catch
{
Write-Error -Message "Failed to import function $($import.fullname): $_"
}
}
Export-ModuleMember -Function $Public.Basename
<# INSERT FOOTER BELOW #>