Skip to content

Commit

Permalink
Layout changes for major version locking
Browse files Browse the repository at this point in the history
  • Loading branch information
ericsciple committed Oct 24, 2016
1 parent 5697456 commit 34a5a15
Show file tree
Hide file tree
Showing 4 changed files with 375 additions and 46 deletions.
39 changes: 26 additions & 13 deletions Compress-Tasks.ps1
@@ -1,24 +1,37 @@
[CmdletBinding()]
param(
[Parameter(Mandatory = $true)]
[string]$IndividualZipStagingPath,
[string]$SourceRoot,

[Parameter(Mandatory = $true)]
[string]$WrapperZipStagingPath,
[string]$TargetPath,

[Parameter(Mandatory = $true)]
[string]$ZipPath)
[switch]$Individually)

$ErrorActionPreference = 'Stop'
Add-Type -Assembly 'System.IO.Compression.FileSystem'
Get-ChildItem -LiteralPath $IndividualZipStagingPath |
ForEach-Object {
$sourceDir = $_.FullName
$targetDir = [System.IO.Path]::Combine($WrapperZipStagingPath, $_.Name)
Write-Host "Compressing $($_.Name)"
[System.IO.Compression.ZipFile]::CreateFromDirectory($sourceDir, "$targetDir\task.zip")
if ($Individually) {
# Create the target root directory.
if (!(Test-Path -LiteralPath $TargetPath -PathType Container)) {
$null = New-Item -Path $TargetPath -ItemType Directory
}

# Create each task zip.
Get-ChildItem -LiteralPath $SourceRoot |
ForEach-Object {
$sourceDir = $_.FullName
$targetDir = [System.IO.Path]::Combine($TargetPath, $_.Name)
Write-Host "Compressing $($_.Name)"
$null = New-Item -Path $targetDir -ItemType Directory
[System.IO.Compression.ZipFile]::CreateFromDirectory($sourceDir, "$targetDir\task.zip")
}
} else {
# Create the target directory.
$targetDir = [System.IO.Path]::GetDirectoryName($TargetPath)
if (!(Test-Path -LiteralPath $targetDir -PathType Container)) {
$null = New-Item -Path $targetDir -ItemType Directory
}

Write-Host "Creating $([System.IO.Path]::GetFileName($ZipPath))"
$null = New-Item -Path ([System.IO.Path]::GetDirectoryName($ZipPath)) -ItemType Directory
[System.IO.Compression.ZipFile]::CreateFromDirectory($WrapperZipStagingPath, $ZipPath)
# Create the zip.
[System.IO.Compression.ZipFile]::CreateFromDirectory($SourceRoot, $TargetPath)
}
18 changes: 18 additions & 0 deletions Expand-Tasks.ps1
@@ -0,0 +1,18 @@
[CmdletBinding()]
param(
[Parameter(Mandatory = $true)]
[string]$ZipPath,

[Parameter(Mandatory = $true)]
[string]$TargetPath)

$ErrorActionPreference = 'Stop'
Add-Type -Assembly 'System.IO.Compression.FileSystem'

# Create the target directory.
if (!(Test-Path -LiteralPath $TargetPath -PathType Container)) {
$null = New-Item -Path $TargetPath -ItemType Directory
}

# Create the zip.
[System.IO.Compression.ZipFile]::ExtractToDirectory($ZipPath, $TargetPath)

0 comments on commit 34a5a15

Please sign in to comment.