Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5ea8a71
commit 3a5109c
Showing
6 changed files
with
62 additions
and
14 deletions.
There are no files selected for viewing
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
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,12 +1,37 @@ | ||
# All internal functions privately available within the toolset - for developers - smaller modules may not have any | ||
# But basically, these are functions that are shared between the exported commands, that you don't nessarily want end users to use | ||
foreach ($function in (Get-ChildItem "$PSScriptRoot\internal\*.ps1")) | ||
$script:ModuleRoot = $PSScriptRoot | ||
|
||
function Import-ModuleFile | ||
{ | ||
[CmdletBinding()] | ||
Param ( | ||
[string] | ||
$Path | ||
) | ||
|
||
if ($doDotSource) { . $Path } | ||
else { $ExecutionContext.InvokeCommand.InvokeScript($false, ([scriptblock]::Create([io.file]::ReadAllText($Path))), $null, $null) } | ||
} | ||
|
||
# Detect whether at some level dotsourcing was enforced | ||
$script:doDotSource = $false | ||
if ($dbachecks_dotsourcemodule) { $script:doDotSource = $true } | ||
if ((Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\WindowsPowerShell\dbachecks\System" -Name "DoDotSource" -ErrorAction Ignore).DoDotSource) { $script:doDotSource = $true } | ||
if ((Get-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\WindowsPowerShell\dbachecks\System" -Name "DoDotSource" -ErrorAction Ignore).DoDotSource) { $script:doDotSource = $true } | ||
|
||
# Execute Preimport actions | ||
. Import-ModuleFile -Path "$ModuleRoot\internal\scripts\preimport.ps1" | ||
|
||
# Import all internal functions | ||
foreach ($function in (Get-ChildItem "$ModuleRoot\internal\functions\*.ps1")) | ||
{ | ||
$ExecutionContext.InvokeCommand.InvokeScript($false, ([scriptblock]::Create([io.file]::ReadAllText($function))), $null, $null) | ||
. Import-ModuleFile -Path $function.FullName | ||
} | ||
|
||
# All exported functions - for end users | ||
foreach ($function in (Get-ChildItem "$PSScriptRoot\functions\*.ps1")) | ||
# Import all public functions | ||
foreach ($function in (Get-ChildItem "$ModuleRoot\functions\*.ps1")) | ||
{ | ||
$ExecutionContext.InvokeCommand.InvokeScript($false, ([scriptblock]::Create([io.file]::ReadAllText($function))), $null, $null) | ||
} | ||
. Import-ModuleFile -Path $function.FullName | ||
} | ||
|
||
# Execute Postimport actions | ||
. Import-ModuleFile -Path "$ModuleRoot\internal\scripts\postimport.ps1" |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
TOPIC | ||
about_dbachecks | ||
|
||
SHORT DESCRIPTION | ||
Explains how to use the dbachecks powershell module | ||
|
||
LONG DESCRIPTION | ||
<Insert Content here> | ||
|
||
KEYWORDS | ||
dbachecks |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
Set-PSFConfig -Module 'dbachecks' -Name 'Example.Setting' -Value 10 -Initialize -Validation 'integer' -Handler { } -Description "Example configuration setting. Your module can then use the setting using 'Get-PSFConfigValue'" |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Add all things you want to run after importing the main code | ||
|
||
# Load Configurations | ||
foreach ($file in (Get-ChildItem "$ModuleRoot\internal\configurations\*.ps1")) { | ||
. Import-ModuleFile -Path $file.FullName | ||
} | ||
|
||
# Load Tab Expansion | ||
foreach ($file in (Get-ChildItem "$ModuleRoot\internal\tepp\*.ps1")) { | ||
. Import-ModuleFile -Path $file.FullName | ||
} |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
# Add all things you want to run before importing the main code |