mirror of
https://github.com/benclaussen/NetboxPS.git
synced 2025-12-13 01:42:28 +00:00
Update deploy.ps1 docs
This commit is contained in:
parent
42b00279cb
commit
48452ce686
1 changed files with 35 additions and 22 deletions
57
deploy.ps1
57
deploy.ps1
|
|
@ -1,18 +1,31 @@
|
|||
<#
|
||||
.SYNOPSIS
|
||||
A brief description of the Invoke-deploy_ps1 file.
|
||||
|
||||
Concatenate files into single PSM1 and PSD1 files
|
||||
|
||||
.DESCRIPTION
|
||||
A description of the file.
|
||||
Concatenate all ps1 files in the Functions directory, plus the root PSM1,
|
||||
into a single PSM1 file in the NetboxPS directory.
|
||||
|
||||
By default, this script will increment version by 0.0.1
|
||||
|
||||
.PARAMETER SkipVersion
|
||||
A description of the SkipVersion parameter.
|
||||
|
||||
Do not increment the version.
|
||||
|
||||
.PARAMETER VersionIncrease
|
||||
A description of the VersionIncrease parameter.
|
||||
|
||||
Increase the version by a user defined amount
|
||||
|
||||
.PARAMETER NewVersion
|
||||
A description of the NewVersion parameter.
|
||||
Override the new version with this version
|
||||
|
||||
.EXAMPLE
|
||||
Use all defaults and concatenate all files
|
||||
|
||||
.\deploy.ps1
|
||||
|
||||
.EXAMPLE
|
||||
Increment the version by 0.2.0. Given version 1.2.0, the resulting version will be 1.4.0
|
||||
|
||||
.\deploy.ps1 -VersionIncrease 0.2.0
|
||||
|
||||
.NOTES
|
||||
===========================================================================
|
||||
|
|
@ -28,10 +41,10 @@ param
|
|||
(
|
||||
[Parameter(ParameterSetName = 'SkipVersion')]
|
||||
[switch]$SkipVersion,
|
||||
|
||||
|
||||
[Parameter(ParameterSetName = 'IncreaseVersion')]
|
||||
[version]$VersionIncrease = "0.0.1",
|
||||
|
||||
|
||||
[Parameter(ParameterSetName = 'SetVersion')]
|
||||
[version]$NewVersion
|
||||
)
|
||||
|
|
@ -55,14 +68,14 @@ $Counter = 0
|
|||
Write-Host "Concatenating [$($PS1Files.Count)] PS1 files from $FunctionPath"
|
||||
foreach ($File in $PS1Files) {
|
||||
$Counter++
|
||||
|
||||
|
||||
try {
|
||||
Write-Host (" Adding file {0:D2}/{1:D2}: $($File.Name)" -f $Counter, $PS1Files.Count)
|
||||
|
||||
|
||||
"`r`n#region File $($File.Name)`r`n" | Out-File -FilePath $ConcatenatedFilePath -Encoding utf8 -Append -ErrorAction Stop
|
||||
|
||||
|
||||
Get-Content $File.FullName -Encoding UTF8 -ErrorAction Stop | Out-File -FilePath $ConcatenatedFilePath -Encoding utf8 -Append -ErrorAction Stop
|
||||
|
||||
|
||||
"`r`n#endregion" | Out-File -FilePath $ConcatenatedFilePath -Encoding utf8 -Append -ErrorAction Stop
|
||||
} catch {
|
||||
Write-Host "FAILED TO WRITE CONCATENATED FILE: $($_.Exception.Message): $($_.TargetObject)" -ForegroundColor Red
|
||||
|
|
@ -85,30 +98,30 @@ switch ($PSCmdlet.ParameterSetName) {
|
|||
"SkipVersion" {
|
||||
# Dont do anything with the PSD
|
||||
Write-Host " Skipping version update, maintaining version [$CurrentVersion]"
|
||||
|
||||
|
||||
break
|
||||
}
|
||||
|
||||
|
||||
"IncreaseVersion" {
|
||||
# Calculate the new version
|
||||
[version]$NewVersion = "{0}.{1}.{2}" -f ($CurrentVersion.Major + $VersionIncrease.Major), ($CurrentVersion.Minor + $VersionIncrease.Minor), ($CurrentVersion.Build + $VersionIncrease.Build)
|
||||
|
||||
|
||||
Write-Host " Updating version in PSD1 from [$CurrentVersion] to [$NewVersion]"
|
||||
|
||||
|
||||
# Replace the version number in the content
|
||||
#$PSDContent -replace $CurrentVersion, $NewVersion | Out-File $PSScriptRoot\$ModuleName.psd1 -Encoding UTF8
|
||||
Update-ModuleManifest -Path "$PSScriptRoot\$ModuleName.psd1" -ModuleVersion $NewVersion
|
||||
|
||||
|
||||
break
|
||||
}
|
||||
|
||||
|
||||
"SetVersion" {
|
||||
Write-Host " Updating version in PSD1 from [$CurrentVersion] to [$NewVersion]"
|
||||
|
||||
|
||||
# Replace the version number in the content
|
||||
#$PSDContent -replace $CurrentVersion, $NewVersion | Out-File $PSScriptRoot\$ModuleName.psd1 -Encoding UTF8
|
||||
Update-ModuleManifest -Path "$PSScriptRoot\$ModuleName.psd1" -ModuleVersion $NewVersion
|
||||
|
||||
|
||||
break
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue