Skip to content

Commit d34feb9

Browse files
committed
Make install scripts handle lack of 'out' directory
1 parent 062386e commit d34feb9

File tree

2 files changed

+35
-8
lines changed

2 files changed

+35
-8
lines changed

install.ps1

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,25 @@ param (
99
)
1010

1111
if ("${LayerPath}" -eq "") {
12-
$LayerPath = (Get-Item out/APILayer.json).FullName
12+
if (Test-Path out/APILayer.json) {
13+
$LayerPath = "out/APILayer.json"
14+
} elseif (Test-Path APILayer.json) {
15+
$LayerPath = "APILayer.json"
16+
}
17+
}
18+
19+
if ("${LayerPath}" -eq "") {
20+
Write-Host "Could not find APILayer.json"
21+
return 1
1322
}
1423

1524
if (-not (Test-Path $LayerPath)) {
1625
Write-Host "LayerPath '${LayerPath}' does not exist."
1726
return 1
1827
}
1928

29+
$LayerPath = (Get-Item $LayerPath).FullName
30+
2031
if ($Mode -eq "Before" -or $Mode -eq "After") {
2132
if ("${RelativeTo}" -eq "") {
2233
Write-Host "Specify -RelativeTo if specifying -Mode Before or -Mode After."

wrap.ps1

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,23 @@
1-
param (
2-
[Parameter(Mandatory = $True)]
3-
[string] $RelativeTo
4-
)
5-
6-
.\install.ps1 -Mode Before -LayerPath (Get-Item out\APILayer.json).FullName -RelativeTo $RelativeTo
7-
.\install.ps1 -Mode After -LayerPath (Get-Item out\APILayer_Alternate.json).FullName -RelativeTo $RelativeTo
1+
param (
2+
[Parameter(Mandatory = $True)]
3+
[string] $RelativeTo
4+
)
5+
6+
if (Test-Path out/APILayer.json) {
7+
$LayerPath = "out/APILayer.json"
8+
} elseif (Test-Path APILayer.json) {
9+
$LayerPath = "APILayer.json"
10+
}
11+
12+
if ("${LayerPath}" -eq "") {
13+
Write-Host "Could not find APILayer.json"
14+
return 1
15+
}
16+
17+
$LayerPath = (Get-Item $LayerPath).FullName
18+
$AltLayerPath = Join-Path (Get-Item $LayerPath).Directory.FullName "APILayer_Alternate.json"
19+
20+
$Install = Join-Path (Get-Item $PSCommandPath).Directory.FullName "install.ps1"
21+
22+
& $Install -Mode Before -LayerPath $LayerPath -RelativeTo $RelativeTo
23+
& $Install -Mode After -LayerPath $AltLayerPath -RelativeTo $RelativeTo

0 commit comments

Comments
 (0)