-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathdefault.ps1
60 lines (52 loc) · 1.56 KB
/
default.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
properties {
$rootDir = Resolve-Path .
$binDir = "$rootDir\bin"
$srcDir = "$rootDir\src"
$toolsDir = "$binDir\tools"
$testDir = "$rootDir\src\tests"
$pesterModule = @(Get-ChildItem $rootDir\* -recurse -include pester.psm1)
}
Task Default -Depends Test
Task Package -Depends Clean,Coalesce,CreateNuGetPackage
Task Clean {
if(Test-Path $binDir) {
Remove-Item -Recurse -Force $binDir
}
}
Task Test {
try {
Import-Module $pesterModule
Invoke-Pester $testDir
# To test a single set of specs
#Invoke-Pester $rootDir\src\tests\CLI.Tests.ps1
} finally {
Remove-Module [p]ester -Force
}
}
Task CreateNuGetPackage {
#& $rootDir\NuGetPackageBuilder.cmd
Copy-Item "$rootDir\nuget\*" $binDir
Copy-Item "$rootDir\chocolateyInstall.ps1" $toolsDir
& nuget pack $binDir\Chewie.nuspec
}
Task DeployLocal -depends Package,TestChocolatey
Task TestChocolatey {
$target = Get-Item $env:ChocolateyInstall\lib\Chewie*
if($target -ne $null -and (Test-Path $target.FullName)) {
Remove-Item -Recurse -Force $target.FullName
}
cinst chewie -pre -force -source "$pwd"
}
Task Coalesce {
$items = Resolve-Path $srcDir\functions\*.ps1 | % { $_.ProviderPath }
$items += Resolve-Path $srcDir\chewie.ps1
if(!(Test-Path $toolsDir)) {
mkdir $toolsDir | Out-Null
}
$content = $items | Get-ChildItem | Get-Content
$content = @('$script:skipFileLoading = $true',"`n") + $content
$content | Out-File -FilePath "$toolsDir\chewie.ps1" -Encoding unicode
}
Task ? {
Write-Documentation
}