Skip to content

Commit 3838f21

Browse files
committed
Fix whitespace issues
1 parent b846f67 commit 3838f21

File tree

3 files changed

+45
-39
lines changed

3 files changed

+45
-39
lines changed

actions_bootstrap.ps1

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,66 +15,71 @@ $modulesToInstall = New-Object System.Collections.Generic.List[object]
1515
}))
1616
# https://github.com/pester/Pester
1717
[void]$modulesToInstall.Add(([PSCustomObject]@{
18-
ModuleName = 'Pester'
18+
ModuleName = 'Pester'
1919
ModuleVersion = '5.6.1'
2020
}))
2121
# https://github.com/nightroman/Invoke-Build
2222
[void]$modulesToInstall.Add(([PSCustomObject]@{
23-
ModuleName = 'InvokeBuild'
23+
ModuleName = 'InvokeBuild'
2424
ModuleVersion = '5.11.3'
2525
}))
2626
# https://github.com/PowerShell/PSScriptAnalyzer
2727
[void]$modulesToInstall.Add(([PSCustomObject]@{
28-
ModuleName = 'PSScriptAnalyzer'
28+
ModuleName = 'PSScriptAnalyzer'
2929
ModuleVersion = '1.23.0'
3030
}))
3131
# https://github.com/PowerShell/platyPS
3232
# older version used due to: https://github.com/PowerShell/platyPS/issues/457
3333
[void]$modulesToInstall.Add(([PSCustomObject]@{
34-
ModuleName = 'platyPS'
34+
ModuleName = 'platyPS'
3535
ModuleVersion = '0.12.0'
3636
}))
3737
# https://github.com/alt3/Docusaurus.Powershell
3838
# Needed for our website documentation
3939
[void]$modulesToInstall.Add(([PSCustomObject]@{
40-
ModuleName = 'Alt3.Docusaurus.Powershell'
40+
ModuleName = 'Alt3.Docusaurus.Powershell'
4141
ModuleVersion = '1.0.37'
4242
}))
4343

4444

4545

4646
'Installing PowerShell Modules'
47-
foreach ($module in $modulesToInstall) {
47+
foreach ($module in $modulesToInstall)
48+
{
4849
$installSplat = @{
49-
Name = $module.ModuleName
50-
RequiredVersion = $module.ModuleVersion
51-
Repository = 'PSGallery'
50+
Name = $module.ModuleName
51+
RequiredVersion = $module.ModuleVersion
52+
Repository = 'PSGallery'
5253
SkipPublisherCheck = $true
53-
Force = $true
54-
Scope = 'CurrentUser'
55-
ErrorAction = 'Stop'
54+
Force = $true
55+
Scope = 'CurrentUser'
56+
ErrorAction = 'Stop'
5657
}
57-
try {
58-
if ($module.ModuleName -eq 'Pester' -and ($IsWindows -or $PSVersionTable.PSVersion -le [version]'5.1')) {
58+
try
59+
{
60+
if ($module.ModuleName -eq 'Pester' -and ($IsWindows -or $PSVersionTable.PSVersion -le [version]'5.1'))
61+
{
5962
# special case for Pester certificate mismatch with older Pester versions - https://github.com/pester/Pester/issues/2389
6063
# this only affects windows builds
6164
Install-Module @installSplat -SkipPublisherCheck
6265
}
63-
elseif ($module.ModuleName -eq 'PSAppDeployToolkit' ) {
66+
elseif ($module.ModuleName -eq 'PSAppDeployToolkit' )
67+
{
6468
# special case for Pester certificate mismatch with older Pester versions - https://github.com/pester/Pester/issues/2389
6569
# this only affects windows builds
6670
Install-Module @installSplat -AllowPreRelease
6771
}
68-
else {
72+
else
73+
{
6974
Install-Module @installSplat
7075
}
7176
Import-Module -Name $module.ModuleName -ErrorAction Stop
7277
' - Successfully installed {0}' -f $module.ModuleName
7378
}
74-
catch {
79+
catch
80+
{
7581
$message = 'Failed to install {0}' -f $module.ModuleName
7682
" - $message"
7783
throw
7884
}
7985
}
80-

src/PSAppDeployToolkit.Tools/Public/Convert-ADTDeployment.ps1

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ function Convert-ADTDeployment
143143

144144
$variableReplacements = @('appVendor', 'appName', 'appVersion', 'appArch', 'appLang', 'appRevision', 'appScriptVersion', 'appScriptAuthor', 'installName', 'installTitle', 'appSuccessExitCodes', 'appRebootExitCodes', 'appProcessesToClose', 'requireAdmin', 'deployAppScriptFriendlyName', 'deployAppScriptVersion')
145145

146-
$customRulePath = [System.IO.Path]::Combine($MyInvocation.MyCommand.Module.ModuleBase, 'PSScriptAnalyzer\Measure-ADTCompatibility.psm1')
146+
$customRulePath = [System.IO.Path]::Combine($MyInvocation.MyCommand.Module.ModuleBase, 'PSScriptAnalyzer\Measure-ADTCompatibility.psm1')
147147
}
148148

149149
process
@@ -320,31 +320,31 @@ function Convert-ADTDeployment
320320
# Get the text form of the hashtable definition
321321
$hashtableContent = $hashtableAst.Right.Extent.Text
322322

323-
# Copy each variable value from the input script to the hashtable
324-
foreach ($variableReplacement in $variableReplacements)
325-
{
326-
$assignmentAst = $inputScriptAst.Find({
327-
param ($ast)
328-
$ast -is [System.Management.Automation.Language.AssignmentStatementAst] -and $ast.Left.Extent.Text -match "^(\[[^\]]+\])?\`$(adtSession\.)?$variableReplacement$"
329-
}, $true)
330-
331-
if ($assignmentAst)
323+
# Copy each variable value from the input script to the hashtable
324+
foreach ($variableReplacement in $variableReplacements)
332325
{
333-
Write-Verbose -Message "Updating variable [$variableReplacement]"
334-
$variableValue = $assignmentAst.Right.Extent.Text
335-
$hashtableContent = $hashtableContent -replace "(?m)(^\s*$variableReplacement\s*=)\s*'[^']*'", "`$1 $variableValue"
326+
$assignmentAst = $inputScriptAst.Find({
327+
param ($ast)
328+
$ast -is [System.Management.Automation.Language.AssignmentStatementAst] -and $ast.Left.Extent.Text -match "^(\[[^\]]+\])?\`$(adtSession\.)?$variableReplacement$"
329+
}, $true)
330+
331+
if ($assignmentAst)
332+
{
333+
Write-Verbose -Message "Updating variable [$variableReplacement]"
334+
$variableValue = $assignmentAst.Right.Extent.Text
335+
$hashtableContent = $hashtableContent -replace "(?m)(^\s*$variableReplacement\s*=)\s*'[^']*'", "`$1 $variableValue"
336+
}
336337
}
337-
}
338338

339339
Write-Verbose -Message 'Updating variable [appScriptDate]'
340340
$hashtableContent = $hashtableContent -replace "(?m)(^\s*appScriptDate\s*=)\s*'[^']+'", "`$1 '$(Get-Date -Format "yyyy-MM-dd")'"
341341

342-
# Update the content of the v4 template script
343-
$start = $hashtableAst.Right.Extent.StartOffset
344-
$end = $hashtableAst.Right.Extent.EndOffset
345-
$scriptContent = $tempScriptAst.Extent.Text
346-
$newScriptContent = ($scriptContent.Substring(0, $start) + $hashtableContent + $scriptContent.Substring($end)).Trim()
347-
Set-Content -Path $outputScriptPath -Value $newScriptContent -Encoding UTF8
342+
# Update the content of the v4 template script
343+
$start = $hashtableAst.Right.Extent.StartOffset
344+
$end = $hashtableAst.Right.Extent.EndOffset
345+
$scriptContent = $tempScriptAst.Extent.Text
346+
$newScriptContent = ($scriptContent.Substring(0, $start) + $hashtableContent + $scriptContent.Substring($end)).Trim()
347+
Set-Content -Path $outputScriptPath -Value $newScriptContent -Encoding UTF8
348348
}
349349
else
350350
{

src/Tests/Unit/PSAppDeployToolkit.ModuleScaffold-Module.Tests.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ Describe 'Module Tests' -Tag Unit {
3838
{ [guid]::Parse($script:manifestEval.Guid) } | Should -Not -Throw
3939
} #guid
4040
It 'should not have any spaces in the tags' {
41-
foreach ($tag in $script:manifestEval.Tags) {
41+
foreach ($tag in $script:manifestEval.Tags)
42+
{
4243
$tag | Should -Not -Match '\s'
4344
}
4445
} #tagSpaces

0 commit comments

Comments
 (0)