forked from Magenic/MAQS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTemplateZip.ps1
78 lines (68 loc) · 3.88 KB
/
TemplateZip.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
<#
.SYNOPSIS
Zips the MAQS project templates.
.DESCRIPTION
This powershell script is used to zip the MAQS project templates. Editing of parameters in the powershell file may be necessary.
.PARAMETER closedSource
Set false if the closeSource version of MAQS shouldn't be updated
.PARAMETER openSource
Set true if the openSource version of MAQS should be updated
.PARAMETER specSource
Set true if the SpecFlow version of MAQS should be updated
.NOTES
Version: 1.0
Author: Magenic
Creation Date: 05/16/2017
Purpose/Change: Initial script development.
Version: 2.0
Author: Magenic
Creation Date: 07/9/2018
Purpose/Change: Add SpecFlow build support. Add item template support.
.EXAMPLE
./TemplateUpdates
This command will zip to the open or closed source version of MAQs, depending on which flags are hardcoded to default to true.
.EXAMPLE
./TemplateUpdates -openSource $true
This command will zip the open source templates.
#>
param (
[bool]$closedSource = $true,
[bool]$openSource = $true,
[bool]$specSource = $true
)
###################################################################################################################
function ZipFiles($inputDirectory, $outputDirectory){
$nunitDir1 = $inputDirectory + "\NUnit"
$nunitDir2 = $inputDirectory + "\NUnit Only"
Set-Location $inputDirectory
$relativePath = Get-ChildItem $inputDirectory -Directory | Resolve-Path -Relative
ForEach($file in $relativePath){
$file = $file.TrimStart(".", " ", "\")
$input = $inputDirectory + "\" + $file
$inputDir = $input + "\*"
$destination = $outputDirectory + "\" + $file + ".zip"
if(($input -ne $nunitDir1) -and ($input -ne $nunitDir2) -and ($input -ne $outputDirectory)){
Write-Host "Zipping " $input
Compress-Archive -Path $inputDir -DestinationPath $destination -Force
##Copy-Item "C:\Users\TroyW\Desktop\QATBaseTemplate.zip" -Destination $destination -Force
}
}
}
function WorkflowFunction($closedSource, $openSource, $specSource){
if($closedSource){
ZipFiles $PSScriptRoot"\Extensions\VisualStudioQatExtension\ProjectTemplates\Magenic Test" $PSScriptRoot"\Extensions\VisualStudioQatExtension\ProjectTemplates\Magenic Test"
ZipFiles $PSScriptRoot"\Extensions\VisualStudioQatExtension\ProjectTemplates\Magenic Test Core" $PSScriptRoot"\Extensions\VisualStudioQatExtension\ProjectTemplates\Magenic Test Core"
ZipFiles $PSScriptRoot"\Extensions\VisualStudioQatExtension\ItemTemplates\Magenic Test" $PSScriptRoot"\Extensions\VisualStudioQatExtension\ItemTemplates\Magenic Test"
}
if($openSource){
ZipFiles $PSScriptRoot"\Extensions\VisualStudioQatExtensionOss\ProjectTemplates\Magenic Test" $PSScriptRoot"\Extensions\VisualStudioQatExtensionOss\ProjectTemplates\Magenic Test"
ZipFiles $PSScriptRoot"\Extensions\VisualStudioQatExtensionOss\ProjectTemplates\Magenic Test Core" $PSScriptRoot"\Extensions\VisualStudioQatExtensionOss\ProjectTemplates\Magenic Test Core"
ZipFiles $PSScriptRoot"\Extensions\VisualStudioQatExtensionOss\ItemTemplates\Magenic Test" $PSScriptRoot"\Extensions\VisualStudioQatExtensionOss\ItemTemplates\Magenic Test"
}
if($specSource){
ZipFiles $PSScriptRoot"\Extensions\MaqsSpecFlowExtension\ProjectTemplates\Magenic SpecFlow Test" $PSScriptRoot"\Extensions\MaqsSpecFlowExtension\ProjectTemplates\Magenic SpecFlow Test"
ZipFiles $PSScriptRoot"\Extensions\MaqsSpecFlowExtension\ProjectTemplates\Magenic SpecFlow Test\NUnit" $PSScriptRoot"\Extensions\MaqsSpecFlowExtension\ProjectTemplates\Magenic SpecFlow Test\NUnit"
ZipFiles $PSScriptRoot"\Extensions\MaqsSpecFlowExtension\ItemTemplates\Magenic SpecFlow Test" $PSScriptRoot"\Extensions\MaqsSpecFlowExtension\ItemTemplates\Magenic SpecFlow Test"
}
}
WorkflowFunction $closedSource $openSource $specSource