From 5b4d043c7d8f6038bdeaeb7c2f03c540c294368b Mon Sep 17 00:00:00 2001 From: OCram85 Date: Tue, 28 Jun 2022 10:32:25 +0200 Subject: [PATCH] wip --- src/ModuleRoot.psm1 | 11 +++++++++++ src/PSCredentialStore.psd1 | 2 +- src/PSCredentialStore.psm1 | 16 ---------------- 3 files changed, 12 insertions(+), 17 deletions(-) create mode 100644 src/ModuleRoot.psm1 delete mode 100644 src/PSCredentialStore.psm1 diff --git a/src/ModuleRoot.psm1 b/src/ModuleRoot.psm1 new file mode 100644 index 0000000..abeede9 --- /dev/null +++ b/src/ModuleRoot.psm1 @@ -0,0 +1,11 @@ +#region module-definition + +#endregion module-definition +Set-Variable -Name "CSVersion" -Value "2.0.0" -Option Constant -Scope 'Script' -ErrorAction Stop + +# Get all child items in the Script path and exclude the Deploy script (if present.) +$Functions = Get-ChildItem -Path $PSScriptRoot\*.ps1 -Recurse | Where-Object { $_.BaseName -notmatch '.Tests' } + +foreach ($Item in $Functions) { + . $Item.FullName +} diff --git a/src/PSCredentialStore.psd1 b/src/PSCredentialStore.psd1 index 6947b23..d2f11b7 100644 --- a/src/PSCredentialStore.psd1 +++ b/src/PSCredentialStore.psd1 @@ -1,7 +1,7 @@ @{ # Script module or binary module file associated with this manifest. - RootModule = 'PSCredentialStore.psm1' + RootModule = 'ModuleRoot.psm1' # Version number of this module. ModuleVersion = '0.0.9999' diff --git a/src/PSCredentialStore.psm1 b/src/PSCredentialStore.psm1 deleted file mode 100644 index 978d81d..0000000 --- a/src/PSCredentialStore.psm1 +++ /dev/null @@ -1,16 +0,0 @@ -#region module-definition - -#endregion module-definition -Set-Variable -Name "CSVersion" -Value "2.0.0" -Option Constant -Scope 'Script' -ErrorAction Stop - -#region dot-sourcing -# dot-sourcing all module functions. The export is handled via manifest file. - -$Items = (Get-ChildItem -Path (Join-Path -Path $PSScriptRoot -ChildPath '*.ps1') -Recurse ).FullName | Where-Object { - $_ -notmatch "(Classes|Init)" -} -foreach ($Item in $Items) { - # Write-Verbose ("dot sourcing file {0}" -f $Item) - . $Item -} -#endregion dot-sourcing