Fixes various code stylings and internal function namings

This commit is contained in:
Christian Stein 2020-08-04 12:39:25 +02:00
parent 3bf87c2f2a
commit 76f27caba4
2 changed files with 40 additions and 35 deletions

View file

@ -1,5 +1,5 @@
@{
ModuleToProcess = 'icinga-powershell-framework.psm1'
RootModule = 'icinga-powershell-framework.psm1'
ModuleVersion = '1.2.0'
GUID = 'fcd7a805-a41b-49f9-afee-9d17a2b76d42'
Author = 'Lord Hepipud'
@ -7,10 +7,22 @@
Copyright = '(c) 2020 Icinga GmbH | MIT'
Description = 'Icinga for Windows module which allows to entirely monitor the Windows Host system.'
PowerShellVersion = '4.0'
FunctionsToExport = @( '*' )
FunctionsToExport = @(
'Use-Icinga',
'Invoke-IcingaCommand',
'Import-IcingaLib',
'Publish-IcingaModuleManifest',
'Publish-IcingaEventlogDocumentation',
'Get-IcingaPluginDir',
'Get-IcingaCustomPluginDir',
'Get-IcingaCacheDir',
'Get-IcingaPowerShellConfigDir',
'Get-IcingaFrameworkRootPath',
'Get-IcingaPowerShellModuleFile'
)
CmdletsToExport = @()
VariablesToExport = '*'
AliasesToExport = @( '*' )
AliasesToExport = @( 'icinga' )
PrivateData = @{
PSData = @{
Tags = @( 'icinga', 'icinga2', 'IcingaPowerShellFramework', 'IcingaPowerShell', 'IcingaforWindows', 'IcingaWindows')

View file

@ -6,7 +6,6 @@
.EXAMPLE
Install-Icinga
.NOTES
#>
function Use-Icinga()
@ -79,12 +78,6 @@ function Use-Icinga()
function Import-IcingaLib()
{
param(
[Parameter(
Position=0,
Mandatory=$true,
ValueFromPipeline=$true,
ValueFromPipelineByPropertyName=$true)
]
[String]$Lib,
# The Force Reload will remove the module in case it's loaded and reload it to track
# possible development changes without having to create new PowerShell environments
@ -126,7 +119,7 @@ function Import-IcingaLib()
} else {
Import-Module ([string]::Format('{0}', $modulePath)) -Global;
if ($WriteManifests) {
Publish-IcingaModuleManifests -Module $moduleName;
Publish-IcingaModuleManifest -Module $moduleName;
}
}
}
@ -142,12 +135,12 @@ function Import-IcingaLib()
Import-Module ([string]::Format('{0}.psm1', $module)) -Global;
if ($WriteManifests) {
Publish-IcingaModuleManifests -Module $moduleName;
Publish-IcingaModuleManifest -Module $moduleName;
}
}
}
function Publish-IcingaModuleManifests()
function Publish-IcingaModuleManifest()
{
param(
[string]$Module
@ -161,7 +154,7 @@ function Publish-IcingaModuleManifests()
return;
}
New-ModuleManifest -path $PSDFile -ModuleVersion 1.0 -Author $env:USERNAME -CompanyName 'Icinga GmbH' -Copyright '(c) 2019 Icinga GmbH. All rights reserved.' -PowerShellVersion 4.0;
New-ModuleManifest -Path $PSDFile -ModuleVersion 1.0 -Author $env:USERNAME -CompanyName 'Icinga GmbH' -Copyright '(c) 2019 Icinga GmbH. All rights reserved.' -PowerShellVersion 4.0;
$Content = Get-Content $PSDFile;
$NewContent = @();
@ -224,7 +217,7 @@ function Publish-IcingaEventlogDocumentation()
}
if ([string]::IsNullOrEmpty($OutFile)) {
Write-Host $DocContent;
Write-Output $DocContent;
} else {
Set-Content -Path $OutFile -Value $DocContent;
}
@ -279,10 +272,10 @@ function Invoke-IcingaCommand()
# Print a header informing our user that loaded the Icinga Framework with a specific
# version. We can also skip the header by using $SKipHeader
if ([string]::IsNullOrEmpty($ScriptBlock) -And $SkipHeader -eq $FALSE) {
Write-Host '******************************************************';
Write-Host ([string]::Format('** Icinga PowerShell Framework {0}', $IcingaFrameworkData.PrivateData.Version));
Write-Host ([string]::Format('** Copyright {0}', $IcingaFrameworkData.Copyright));
Write-Host '******************************************************';
Write-Output '******************************************************';
Write-Output ([string]::Format('** Icinga PowerShell Framework {0}', $IcingaFrameworkData.PrivateData.Version));
Write-Output ([string]::Format('** Copyright {0}', $IcingaFrameworkData.Copyright));
Write-Output '******************************************************';
}
powershell.exe -NoExit -Command {