-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpackage.ps1
30 lines (23 loc) · 906 Bytes
/
package.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
$packageDir = "$PSScriptRoot\package"
$packagingDir = "$packageDir\TfsBuildTools"
$moduleName = "TfsBuildTools"
if(Test-Path $packageDir)
{
Remove-Item $packageDir -Force -Recurse | Out-Null
}
New-Item -ItemType Directory $packageDir | Out-Null
New-Item -ItemType Directory $packagingDir | Out-Null
#gather files in the module TfsSecurityTools folder
Copy-Item $PSScriptRoot\module\*.ps*1 -Destination $packagingDir
Copy-Item $PSScriptRoot\install.ps1 -Destination $packagingDir
#create a zip package
$zipFile = "$packageDir\$($moduleName).zip"
if(Test-Path $zipFile)
{
Get-ChildItem -File $zipFile | Remove-Item
}
Add-Type -Assembly System.IO.Compression.FileSystem
$compressionLevel = [System.IO.Compression.CompressionLevel]::Optimal
[System.IO.Compression.ZipFile]::CreateFromDirectory($packagingDir,$zipFile, $compressionLevel, $false)
#open the package directory
explorer $packageDir