forked from pester/Pester
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cleanUpBeforeBuild.ps1
29 lines (24 loc) · 1.02 KB
/
cleanUpBeforeBuild.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
# cleaning up remains of previous builds
# examples and all test files
# in the next step we sign all scripts so
# we want to reduce how many files will be signed
#
# this clean up is not removing all unneeded files,
# it only removes the main parts
# each package then decides what will be part of it
$buildDir = "$PSScriptRoot\build"
$ErrorActionPreference = 'Stop'
if (Test-Path $buildDir) {
Write-Verbose "Removing build dir"
Remove-Item $buildDir -Recurse -Force -Confirm:$false -Verbose -ErrorAction 'Stop'
}
if (Test-Path "$PSScriptRoot\Examples") {
Write-Verbose "Removing all examples"
Remove-Item "$PSScriptRoot\Examples" -Recurse -Force -Confirm:$false -Verbose -ErrorAction 'Stop'
}
if (Test-Path "$PSScriptRoot\images") {
Write-Verbose "Removing images"
Remove-Item "$PSScriptRoot\images" -Recurse -Force -Confirm:$false -Verbose -ErrorAction 'Stop'
}
Write-Verbose "Removing all Test Files"
Get-ChildItem $PSScriptRoot -Recurse -Filter *.Tests.ps1 | Remove-Item -Force -Verbose -ErrorAction 'Stop'