11Set-StrictMode - Version 1.0
22
3- $dirList = @ (
4- ' tests'
5- )
6- $listofFiles = [System.IO.Directory ]::EnumerateFiles((" {0}" -f $PSScriptRoot ), " *.ps1" , " AllDirectories" ).Where ({$_.EndsWith (' .ps1' )})
7- $all_files = $listofFiles.Where ({! [System.IO.Path ]::GetDirectoryName($_ ).ToLower().ToString().Contains($dirList ) -and ($_ -like ' *public*' -or $_ -like ' *private*' )})
8- $content = $all_files.ForEach ({
9- [System.IO.File ]::ReadAllText($_ , [Text.Encoding ]::UTF8) + [Environment ]::NewLine
10- })
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+ }
119
12- # Set-Content -Path $tmpFile -Value $content
13- . ([scriptblock ]::Create($content ))
10+ # Import psmarkdig module
11+ $markdownPsModule = Join-Path $modulesRoot ' psmarkdig/psmarkdig.psd1'
12+ If (-not (Get-Module - Name ' psmarkdig' )) {
13+ Import-Module $markdownPsModule
14+ }
1415
16+ # Import localized data
1517$LocalizedDataParams = @ {
1618 BindingVariable = ' messages' ;
17- BaseDirectory = " {0}/{1} " -f $PSScriptRoot , " Localized" ;
19+ BaseDirectory = ( Join-Path $PSScriptRoot ' Localized' ) ;
1820}
1921# Import localized data
20- Import-LocalizedData @LocalizedDataParams ;
22+ Import-LocalizedData @LocalizedDataParams ;
23+
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+ }
39+
0 commit comments