Public/New-SpecModule.ps1
function New-SpecModule { [cmdletbinding()] param ( [parameter (mandatory = $true)] [string]$moduleName, [parameter (mandatory = $true)] [string]$modulePath, [parameter (mandatory = $true)] [string]$moduleShortDescription ) begin { # Create folder structure $fullModulePath = Join-Path $modulePath $moduleName if (!(Test-Path $fullModulePath)) { Write-verbose "creating module directory structure" $FoldersCreated = new-SpecModuleStructure -modulename $moduleName -modulepath $modulePath -verbose } else { Write-Warning "Path already exists. Please choose a different path or module name." $FoldersCreated = $false } #initialise other vars $PSM1Created = $false $moduleHelpCreated = $false $psd1Created = $false } process { if ($FoldersCreated) { #Creating .psm1 module loader $PSM1Created = Add-SpecPSM1 -moduleName $moduleName -modulePath $modulePath -Verbose if ($PSM1Created) { # Create module help file template $moduleHelpCreated = Add-SpecModuleHelp -moduleName $moduleName -modulePath $modulePath -moduleShortDescription $moduleShortDescription -Verbose } if ($moduleHelpCreated) { # Create .psd1 module manifest file $psd1Created = new-specModuleManifest -moduleName $moduleName -modulePath $modulePath -moduleShortDescription $moduleShortDescription -verbose } if ($psd1Created) { return $true } else { return $false } } } } |