Skip to content

Commit f3f40d3

Browse files
bugfixes
1 parent bd0b096 commit f3f40d3

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

PSModuleDevelopment/functions/build/Resolve-PSMDBuildStepParameter.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,11 @@
7272
}
7373

7474
# Resolve implicit artifact references
75-
foreach ($pair in $Parameters.GetEnumerator()) {
76-
if ($pair.Value -notlike '%!*!%') { continue }
75+
foreach ($key in $($Parameters.Keys)) {
76+
if ($Parameters.$key -notlike '%!*!%') { continue }
7777

78-
$artifactName = $pair.Value -replace '^%!(.+?)!%$', '$1'
79-
$Parameters[$pair.Key] = (Get-PSMDBuildArtifact -Name $artifactName).Value
78+
$artifactName = $Parameters.$key -replace '^%!(.+?)!%$', '$1'
79+
$Parameters[$Key] = (Get-PSMDBuildArtifact -Name $artifactName).Value
8080
}
8181

8282
$Parameters

PSModuleDevelopment/internal/buildActions/deployModule.action.ps1

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
param (
33
$Parameters
44
)
5+
6+
trap {
7+
if ($workingDirectory) {
8+
Remove-Item -Path $workingDirectory -Recurse -Force -ErrorAction SilentlyContinue
9+
}
10+
throw $_
11+
}
512

613
$rootPath = $Parameters.RootPath
714
$actualParameters = $Parameters.Parameters
@@ -11,7 +18,7 @@
1118
throw "No Sessions specified!"
1219
}
1320

14-
if ($actualParameters.Session | Where-Object State -NE Open) {
21+
if ($actualParameters.Session | Where-Object State -NE Opened) {
1522
throw "Sessions not open!"
1623
}
1724
if ($actualParameters.Repository -and (-not (Get-PSRepository -Name $actualParameters.Repository -ErrorAction Ignore))) {
@@ -29,10 +36,6 @@
2936
#region Prepare modules to transfer
3037
$workingDirectory = Join-Path -Path (Get-PSFPath -Name temp) -ChildPath "psmd_action_$(Get-Random)"
3138
$null = New-Item -Path $workingDirectory -ItemType Directory -Force -ErrorAction Stop
32-
trap {
33-
Remove-Item -Path $workingDirectory -Recurse -Force -ErrorAction SilentlyContinue
34-
throw $_
35-
}
3639

3740
$saveModuleParam = @{
3841
Path = $workingDirectory
@@ -64,6 +67,7 @@
6467
if (-not $actualParameters.NoDelete) {
6568
Invoke-Command -Session $actualParameters.Session -ScriptBlock {
6669
param ($Name)
70+
if (-not (Test-Path -Path "$env:ProgramFiles\WindowsPowerShell\Modules\$Name")) { return }
6771
Remove-Item -Path "$env:ProgramFiles\WindowsPowerShell\Modules\$Name" -Recurse -Force
6872
} -ArgumentList $moduleFolder.Name
6973
}

0 commit comments

Comments
 (0)