-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhancement (module): Simplify script module file
- Loading branch information
1 parent
6474c0a
commit 7e29b24
Showing
1 changed file
with
12 additions
and
17 deletions.
There are no files selected for viewing
29 changes: 12 additions & 17 deletions
29
src/PSRepositoryReleaseManager/PSRepositoryReleaseManager.psm1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,16 @@ | ||
Set-StrictMode -Version Latest | ||
|
||
################## | ||
# Module globals # | ||
################## | ||
# Initialize variables | ||
$MODULE_BASE_DIR = $PSScriptRoot | ||
$MODULE_PRIVATE_DIR = Join-Path $MODULE_BASE_DIR 'Private' | ||
$MODULE_PUBLIC_DIR = Join-Path $MODULE_BASE_DIR 'Public' | ||
$MODULE_GENERATE_DIR = Join-Path $MODULE_BASE_DIR 'generate' | ||
$MODULE_VARIANT_DIR = Join-Path $MODULE_GENERATE_DIR 'variants' | ||
|
||
# Module constants | ||
$script:MODULE = @{} | ||
$script:MODULE['BASE_DIR'] = $PSScriptRoot | ||
$script:MODULE['PUBLIC_DIR'] = Join-Path $script:MODULE['BASE_DIR'] 'Public' # Module public functions | ||
$script:MODULE['PRIVATE_DIR'] = Join-Path $script:MODULE['BASE_DIR'] 'Private' # Module private functions | ||
$script:MODULE['GENERATE_DIR'] = Join-Path $script:MODULE['BASE_DIR'] 'generate' | ||
$script:MODULE['VARIANT_DIR'] = Join-Path $script:MODULE['GENERATE_DIR'] 'variants' | ||
# Load functions | ||
Get-ChildItem "$MODULE_PRIVATE_DIR\*.ps1" -exclude *.Tests.ps1 | % { . $_.FullName } | ||
Get-ChildItem "$MODULE_PUBLIC_DIR\*.ps1" -exclude *.Tests.ps1 | % { . $_.FullName } | ||
Get-ChildItem "$MODULE_VARIANT_DIR\*.ps1" -exclude *.Tests.ps1 | % { . $_.FullName } | ||
|
||
# Load vendor, Public, Private, classes, helpers | ||
Get-ChildItem -Path "$($script:MODULE['PUBLIC_DIR'])\*.ps1" | % { . $_.FullName } | ||
Get-ChildItem -Path "$($script:MODULE['PRIVATE_DIR'])\*.ps1" | % { . $_.FullName } | ||
Get-ChildItem -Path "$($script:MODULE['VARIANT_DIR'])\*.ps1" | % { . $_.FullName } | ||
|
||
# Export Public functions | ||
Export-ModuleMember -Function (Get-ChildItem "$($script:MODULE['PUBLIC_DIR'])\*.ps1" | Select-Object -ExpandProperty BaseName) | ||
# Export functions | ||
Export-ModuleMember -Function (Get-ChildItem "$MODULE_PUBLIC_DIR\*.ps1" | Select-Object -ExpandProperty BaseName) |