removed whatif script

This commit is contained in:
Miodrag Milic
2017-05-23 00:37:48 +02:00
parent 24d8067f62
commit a9f85be6b3
-43
View File
@@ -1,43 +0,0 @@
<#
This script implements WhatIf functionality. When you use it, it will
- backup a package prior a call to update
- save updater output to another folder
- restore an original package after update finishes
Use it by adding a switch parameter to update.ps1 and surrounding update
by backup and restore functions:
param( [switch]$WhatIf )
...
backup
tru {
update ...
} finally { restore }
#>
function backup() {
if (!$WhatIf) { return }
Write-Warning "WhatIf passed - package files will not be changed"
$packageName = Split-Path -Leaf $MyInvocation.PSScriptRoot
$d = "$Env:TEMP\au\$packageName"
rm $d\* -Recurse -ea 0
cp . $d\_backup -Recurse
}
function restore() {
if (!$WhatIf) { return }
$packageName = Split-Path -Leaf $MyInvocation.PSScriptRoot
$d = "$Env:TEMP\au\$packageName"
cp . $d\_output -Recurse
rm .\* -Recurse
cp $d\_backup\* . -Recurse
Write-Warning "Package saved to: $d\_output"
}