spec.module.management.psm1
# Get class definition files from the 'Classes' directory $ClassFiles = @(Get-ChildItem -Path $PSScriptRoot\Classes\*.ps1 -ErrorAction SilentlyContinue) # Dot-source class definition files Foreach ($class in $ClassFiles) { Try { . $class.FullName } Catch { Write-Error -Message "Failed to import class $($class.FullName): $_" } } # 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 function definition files Foreach ($import in @($Public + $Private)) { Try { . $import.FullName } Catch { Write-Error -Message "Failed to import function $($import.FullName): $_" } } # Export public functions Export-ModuleMember -Function $Public.Basename |