forked from automotiveMastermind/condo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
condo.ps1
33 lines (26 loc) · 845 Bytes
/
condo.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#requires -version 4
# find the script path
$RootPath = $PSScriptRoot
# setup well-known paths
$CondoScriptPath = Join-Path $RootPath "condo-local.ps1"
$TemplatePath = Join-Path $RootPath "template"
$CondoTemplatePath = Join-Path $TemplatePath "condo.ps1"
# determine if condo-local.ps1 already exists and delete it if it does
if (Test-Path $CondoScriptPath) {
Remove-Item -Force $CondoScriptPath
}
# copy the template to the local path
Copy-Item $CondoTemplatePath $CondoScriptPath > $null
# run condo using local build
try {
# change to the root path
Push-Location $RootPath
# execute the local script
& $CondoScriptPath -Reset -Local @args
}
finally {
# change back to the current path
Pop-Location
# remove the local condo script
Remove-Item -Force $CondoScriptPath -ErrorAction SilentlyContinue
}