Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
potatoqualitee committed Dec 18, 2017
1 parent 5ea8a71 commit 3a5109c
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 14 deletions.
11 changes: 5 additions & 6 deletions dbachecks.psd1
@@ -1,9 +1,9 @@
#
# Module manifest for module 'dbachecks'
#
# Generated by: You, you big playa!
# Generated by: Chrissy LeMaire
#
# Generated on: 4/14/2017
# Generated on: 12/18/2017
#
@{

Expand All @@ -23,7 +23,7 @@
CompanyName = 'SQL Community Collaborative'

# Copyright statement for this module
Copyright = '2017 dbatools'
Copyright = '(c) 2017. All rights reserved.'

# Description of the functionality provided by this module
Description = 'Automates testing for SQL Server stuff'
Expand Down Expand Up @@ -73,8 +73,7 @@
# Functions to export from this module
# This is the stuff in \enduser-functions
FunctionsToExport = @(
'Clear-AcmeSqlConnectionPool',
'Test-AcmeSqlPath'
''
)

# Cmdlets to export from this module
Expand Down Expand Up @@ -103,7 +102,7 @@
Category = "Databases"

# Keyword tags to help users find this module via navigations and search.
Tags = @('sqlserver', 'sql', 'dba', 'databases', 'audits')
Tags = @('sqlserver', 'sql', 'dba', 'databases', 'audits','checklists')

# The web address of an icon which can be used in galleries to represent this module
IconUri = "https://dbatools.io/logo.png"
Expand Down
41 changes: 33 additions & 8 deletions dbachecks.psm1
@@ -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"
11 changes: 11 additions & 0 deletions en-us/about_dbachecks.help.txt
@@ -0,0 +1,11 @@
TOPIC
about_dbachecks

SHORT DESCRIPTION
Explains how to use the dbachecks powershell module

LONG DESCRIPTION
<Insert Content here>

KEYWORDS
dbachecks
1 change: 1 addition & 0 deletions internal/configurations/example-configuration.ps1
@@ -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'"
11 changes: 11 additions & 0 deletions internal/scripts/postimport.ps1
@@ -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
}
1 change: 1 addition & 0 deletions internal/scripts/preimport.ps1
@@ -0,0 +1 @@
# Add all things you want to run before importing the main code

0 comments on commit 3a5109c

Please sign in to comment.