Add Expand-Template.cmd stub
This commit is contained in:
Родитель
f78ee0462a
Коммит
7248b76f71
|
@ -0,0 +1,4 @@
|
|||
@echo off
|
||||
SETLOCAL
|
||||
set PS1UnderCmd=1
|
||||
powershell.exe -NoProfile -NoLogo -ExecutionPolicy bypass -Command "try { & '%~dpn0.ps1' %*; exit $LASTEXITCODE } catch { write-host $_; exit 1 }"
|
|
@ -149,11 +149,11 @@ try {
|
|||
|
||||
# Self destruct
|
||||
$Invocation = (Get-Variable MyInvocation -Scope 1).Value
|
||||
git rm Expand-Template.ps1
|
||||
git rm Expand-Template.*
|
||||
git rm :/azure-pipelines/expand-template.yml
|
||||
|
||||
# Self-integrity check
|
||||
Get-ChildItem -Recurse -File -Exclude bin,obj,README.md,Expand-Template.ps1 |? { -not $_.FullName.Contains("obj") } |% {
|
||||
Get-ChildItem -Recurse -File -Exclude bin,obj,README.md,Expand-Template.* |? { -not $_.FullName.Contains("obj") } |% {
|
||||
$PLACEHOLDERS = Get-Content -Path $_.FullName |? { $_.Contains('PLACEHOLDER') }
|
||||
if ($PLACEHOLDERS) {
|
||||
Write-Error "PLACEHOLDER discovered in $($_.FullName)"
|
||||
|
@ -162,6 +162,15 @@ try {
|
|||
|
||||
# Commit the changes
|
||||
git commit -qm "Expanded template for $LibraryName" -m "This expansion done by the (now removed) Expand-Template.ps1 script."
|
||||
|
||||
Write-Host -ForegroundColor Green "Template successfully expanded."
|
||||
|
||||
if ($env:PS1UnderCmd) {
|
||||
# We're running under the Expand-Template.cmd script.
|
||||
# Since we just deleted it from disk cmd.exe will complain. Just advise the user it's OK.
|
||||
Write-Host -ForegroundColor Green 'Disregard an error you may see: "The batch file cannot be found." We just cleaned up after ourselves.'
|
||||
}
|
||||
|
||||
} finally {
|
||||
Pop-Location
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче