-
Notifications
You must be signed in to change notification settings - Fork 0
/
make.ps1
85 lines (81 loc) · 2.4 KB
/
make.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<#
.SYNOPSIS
Run PDQTest targets
.DESCRIPTION
See the instructions at https://github.com/declarativesystems/pdqtest/blob/master/doc/running_tests.md
.EXAMPLE
.\make.ps1 - Run the default testing target
.EXAMPLE
.\make.ps1 XXX - run the XXX target
.PARAMETER target
Test suite to run
#>
param(
$target = "all"
)
# *File originally created by PDQTest*
$gfl = "Gemfile.local"
$gfp = "Gemfile.project"
# Relink Gemfile.local
# https://github.com/declarativesystems/pdqtest/blob/master/doc/pdk.md#why-are-the-launch-scripts-essentialhow-does-the-pdqtest-gem-load-itself
function Install-GemfileLocal {
# on windows, symlinks dont work on vagrant fileshares, so just copy the
# file if needed
if (Test-Path $gfl) {
$gflMd5 = (Get-FileHash -Path $gfl -Algorithm MD5).Hash
$gfpMd5 = (Get-FileHash -Path $gfp -Algorithm MD5).Hash
if ($gflMd5 -eq $gfpMd5) {
# OK - ready to launch
} else {
write-error "$($gfl) different content to $($gfp)! Move it out the way or move the content to $($gfp)"
}
} else {
write-host "[(-_-)zzz] Copying $($gfp) to $($gfl) and running pdk bundle..."
copy $gfp $gfl
pdk bundle install
}
}
switch ($target) {
"all" {
cd .pdqtest; bundle exec pdqtest all; cd ..
}
"fast" {
cd .pdqtest; bundle exec pdqtest fast; cd ..
}
"acceptance" {
cd .pdqtest; bundle exec pdqtest acceptance; cd ..
}
"shell" {
cd .pdqtest; bundle exec pdqtest --keep-container acceptance; cd ..
}
"shellnopuppet" {
cd .pdqtest; bundle exec pdqtest shell; cd ..
}
"setup" {
cd .pdqtest; bundle exec pdqtest setup; cd ..
}
"logical" {
cd .pdqtest; bundle exec pdqtest logical; cd ..
}
"docs" {
cd .pdqtest ; bundle exec "cd ..; puppet strings generate --format markdown"; cd ..
}
"Gemfile.local" {
echo "[(-_-)zzz] *copying* Gemfile.project to Gemfile.local and running pdk bundle..."
Install-GemfileLocal
.\make.ps1 pdkbundle
}
"pdqtestbundle" {
cd .pdqtest ; bundle install; cd ..
}
"pdkbundle" {
pdk bundle install
}
"clean" {
Remove-Item -ErrorAction SilentlyContinue -Confirm:$false -Recurse -force pkg
Remove-Item -ErrorAction SilentlyContinue -Confirm:$false -Recurse -force spec/fixtures/modules
}
default {
Write-Error "No such target: $($target)"
}
}