cmder/scripts/pack.ps1

58 lines
1.5 KiB
PowerShell
Raw Normal View History

2014-04-10 18:41:19 +08:00
<#
.Synopsis
Pack cmder
.DESCRIPTION
Use this script to pack cmder into release archives
You will need to make this script executable by setting your Powershell Execution Policy to Remote signed
Then unblock the script for execution with UnblockFile .\pack.ps1
.EXAMPLE
.\pack.ps1
Creates default archives for cmder
.EXAMPLE
.\build -verbose
Creates default archives for cmder with plenty of information
.NOTES
AUTHORS
Samuel Vasko, Jack Bennett, Martin Kemp
2014-04-10 18:41:19 +08:00
Part of the Cmder project.
.LINK
https://github.com/cmderdev/cmder - Project Home
2014-04-10 18:41:19 +08:00
#>
[CmdletBinding(SupportsShouldProcess=$true)]
Param(
# CmdletBinding will give us;
# -verbose switch to turn on logging and
# -whatif switch to not actually make changes
# Path to the vendor configuration source file
[string]$cmderRoot = "..",
# Vendor folder locaton
2014-04-10 19:11:41 +08:00
[string]$saveTo = "..\build"
2014-04-10 18:41:19 +08:00
)
. "$PSScriptRoot\utils.ps1"
$ErrorActionPreference = "Stop"
2014-08-27 06:52:49 +08:00
Ensure-Executable "7z"
2014-04-10 18:41:19 +08:00
$targets = @{
"cmder.zip" = $null;
"cmder.7z" = $null;
"cmder_mini.zip" = "-x!`"vendor\git-for-windows`"";
2014-04-10 18:41:19 +08:00
}
2014-04-10 19:11:41 +08:00
Delete-Existing "..\Version*"
Delete-Existing "..\build\*"
2014-04-10 19:11:41 +08:00
2014-04-10 18:41:19 +08:00
$version = Invoke-Expression "git describe --abbrev=0 --tags"
2014-04-10 20:42:20 +08:00
(New-Item -ItemType file "$cmderRoot\Version $version") | Out-Null
2014-04-10 18:41:19 +08:00
foreach ($t in $targets.GetEnumerator()) {
Create-Archive $cmderRoot "$saveTo\$($t.Name)" $t.Value
2014-04-10 19:11:41 +08:00
$hash = (Digest-MD5 "$saveTo\$($t.Name)")
Add-Content "$saveTo\hashes.txt" $hash
2014-04-10 18:41:19 +08:00
}