Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Solve cross-platform import problem on MacOS build #910

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Next Next commit
Fix module import path to work across platforms
Signed-off-by: Stuart Preston <[email protected]>
stuartpreston committed Jan 2, 2023
commit a1932e698fc456011fc02460314c8a4bbcfb8ee3
15 changes: 2 additions & 13 deletions source/dbachecks.psm1
Original file line number Diff line number Diff line change
@@ -26,13 +26,7 @@ if ((Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\WindowsPowerShell\dbacheck
if ((Get-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\WindowsPowerShell\dbachecks\System" -Name "DoDotSource" -ErrorAction Ignore).DoDotSource) { $script:doDotSource = $true }

# Execute Preimport actions
if($IsLinux){
Write-Verbose "Loading preimport in linux"
. Import-ModuleFile -Path "$ModuleRoot/internal/scripts/preimport.ps1"
}else{
. Import-ModuleFile -Path "$ModuleRoot\internal\scripts\preimport.ps1"
}

. Import-ModuleFile -Path (Convert-Path -Path "$ModuleRoot\internal\scripts\preimport.ps1")

# Import all internal functions
foreach ($function in (Get-ChildItem "$ModuleRoot\internal\functions\*.ps1")) {
@@ -45,12 +39,7 @@ foreach ($function in (Get-ChildItem "$ModuleRoot\functions\*.ps1")) {
}

# Execute Postimport actions
if($IsLinux){
Write-Verbose "Loading postimport in linux"
. Import-ModuleFile -Path "$ModuleRoot/internal/scripts/postimport.ps1"
}else{
. Import-ModuleFile -Path "$ModuleRoot\internal\scripts\postimport.ps1"
}
. Import-ModuleFile -Path (Convert-Path -Path "$ModuleRoot\internal\scripts\postimport.ps1")

if (-not (Test-Path Alias:Update-Dbachecks)) { Set-Alias -Scope Global -Name 'Update-Dbachecks' -Value 'Update-DbcRequiredModules' }
$VerbosePreference = "SilentlyContinue"