From 7badb7cda84e94abae5e06ae3c53b3707b9c9cf7 Mon Sep 17 00:00:00 2001 From: Ben Claussen Date: Tue, 8 Dec 2020 11:45:20 -0500 Subject: [PATCH] Update deploy.ps1 variables --- deploy.ps1 | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/deploy.ps1 b/deploy.ps1 index 5644884..bb9e2cb 100644 --- a/deploy.ps1 +++ b/deploy.ps1 @@ -40,15 +40,17 @@ Write-Host "Beginning deployment" -ForegroundColor Green $ModuleName = 'NetboxPS' $ConcatenatedFilePath = "$PSScriptRoot\concatenated.ps1" -$PSD1OutputPath = "$PSScriptRoot\$ModuleName\$ModuleName.psd1" -$PSM1OutputPath = "$PSScriptRoot\$ModuleName\$ModuleName.psm1" +$FunctionPath = "$PSScriptRoot\Functions" +$OutputDirectory = "$PSScriptRoot\$ModuleName" +$PSD1OutputPath = "$OutputDirectory\$ModuleName.psd1" +$PSM1OutputPath = "$OutputDirectory\$ModuleName.psm1" -$PS1Files = Get-ChildItem "$PSScriptRoot\Functions" -Filter "*.ps1" -Recurse | Sort-Object Name +$PS1Files = Get-ChildItem $FunctionPath -Filter "*.ps1" -Recurse | Sort-Object Name "" | Out-File -FilePath $ConcatenatedFilePath -Encoding utf8 $Counter = 0 -Write-Host "Concatenating [$($PS1Files.Count)] PS1 files from $PSScriptRoot\Functions" +Write-Host "Concatenating [$($PS1Files.Count)] PS1 files from $FunctionPath" foreach ($File in $PS1Files) { $Counter++ @@ -109,6 +111,16 @@ switch ($PSCmdlet.ParameterSetName) { } } + +if (-not (Test-Path $OutputDirectory)) { + try { + Write-Warning "Creating path [$OutputDirectory]" + $null = New-Item -Path $OutputDirectory -ItemType Directory -Force + } catch { + throw "Failed to create directory [$OutputDirectory]: $($_.Exception.Message)" + } +} + Write-Host " Copying psd1" Copy-Item -Path "$PSScriptRoot\$ModuleName.psd1" -Destination $PSD1OutputPath -Force