|
1 | 1 | Set-StrictMode -Version Latest #-Version 1.0 |
2 | 2 |
|
| 3 | +#Import monkey utils |
| 4 | +$modulesRoot = Split-Path -Parent $PSScriptRoot |
| 5 | +$monkeyutils = Join-Path $modulesRoot 'monkeyutils/monkeyutils.psd1' |
| 6 | +If (-not (Get-Module -Name 'monkeyutils')) { |
| 7 | + Import-Module $monkeyutils |
| 8 | +} |
| 9 | + |
| 10 | +#Import psmarkdig module |
| 11 | +$markdownPsModule = Join-Path $modulesRoot 'psmarkdig/psmarkdig.psd1' |
| 12 | +If (-not (Get-Module -Name 'psmarkdig')) { |
| 13 | + Import-Module $markdownPsModule |
| 14 | +} |
| 15 | + |
| 16 | +# Import localized data |
3 | 17 | $LocalizedDataParams = @{ |
4 | 18 | BindingVariable = 'messages'; |
5 | | - BaseDirectory = "{0}/{1}" -f $PSScriptRoot, "Localized"; |
| 19 | + BaseDirectory = (Join-Path $PSScriptRoot 'Localized'); |
6 | 20 | } |
7 | 21 | #Import localized data |
8 | 22 | Import-LocalizedData @LocalizedDataParams; |
9 | 23 |
|
10 | | -$listofFiles = [System.IO.Directory]::EnumerateFiles(("{0}" -f $PSScriptRoot),"*.ps1","AllDirectories") |
11 | | -$all_files = $listofFiles.Where({($_ -like "*public*") -or ($_ -like "*private*")}) |
12 | | -$all_files.ForEach({. $_}) |
| 24 | +#Import public and private files |
| 25 | +$sourceFolders = @('private', 'public') |
| 26 | +ForEach ($folder in $sourceFolders) { |
| 27 | + $path = Join-Path $PSScriptRoot $folder |
| 28 | + If (-not (Test-Path $path)) { |
| 29 | + continue |
| 30 | + } |
| 31 | + $files = [System.IO.Directory]::EnumerateFiles($path,'*',[System.IO.SearchOption]::AllDirectories) |
| 32 | + ForEach ($file in ($files | Sort-Object)) { |
| 33 | + If ([System.IO.Path]::GetExtension($file) -ne '.ps1') { |
| 34 | + continue |
| 35 | + } |
| 36 | + . $file |
| 37 | + } |
| 38 | +} |
0 commit comments