-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cbca31f
commit 35bd928
Showing
11 changed files
with
1,109 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
*.ps1 -crlf | ||
*.psm1 -crlf | ||
*.psd1 -crlf | ||
|
||
VirtualEngine.Compression.Tests.ps1 export-ignore | ||
VirtualEngine.Compression.png export-ignore | ||
Build.ps1 export-ignore | ||
.gitignore export-ignore | ||
.gitattributes export-ignore | ||
ChocolateyInstall.ps1 export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Releases/ | ||
Release.ps1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
$Properties = @{ | ||
CertificateThumbprint = 'D10BB31E5CE3048A7D4DA0A4DD681F05A85504D3'; | ||
ReleaseDirectory = '.\Releases'; | ||
TimeStampServer = 'http://timestamp.verisign.com/scripts/timestamp.dll'; | ||
LicenseUrl = 'https://raw.githubusercontent.com/VirtualEngine/ZipArchive/master/LICENSE'; | ||
DownloadBaseUrl = 'http://virtualengine.co.uk/wp-content/uploads'; | ||
} | ||
|
||
Import-Module VirtualEngine.Build -ErrorAction Stop; | ||
#Import-Module Posh-SSH -ErrorAction Stop; | ||
|
||
$module = Get-ModuleManifest; | ||
$packageName = "$($module.Name.Replace('.','-'))-$($module.Version.ToString())"; | ||
$tempDirectory = Join-Path $env:TEMP $module.Name; | ||
$zipDirectory = Join-Path $tempDirectory $module.Name; | ||
|
||
task default -depends CreateReleaseZip, CreateChocolateyReleasePackage, RemoveReleaseDirectory | ||
|
||
task CreateReleaseZipDirectory { | ||
Remove-Item -Path $tempDirectory -Recurse -Force -ErrorAction SilentlyContinue; | ||
[ref] $null = New-Item -Path $zipDirectory -ItemType Container; | ||
} | ||
|
||
task StageReleaseZipFiles -depends CreateReleaseZipDirectory { | ||
|
||
$codeSigningCert = Get-ChildItem Cert:\ -CodeSigningCert -Recurse | Where Thumbprint -eq $Properties.CertificateThumbprint; | ||
|
||
foreach ($moduleFile in Get-ModuleFiles) { | ||
Copy-Item -Path $moduleFile.FullName -Destination $zipDirectory -Force; | ||
|
||
if ($moduleFile.Extension -in '.ps1','.psm1') { | ||
$moduleFilePath = Join-Path $zipDirectory $moduleFile.Name; | ||
Write-Verbose ("Signing file '{0}'." -f $moduleFilePath); | ||
$signResult = Set-ScriptSigntaure -Path $moduleFilePath -Thumbprint $Properties.CertificateThumbprint -TimeStampServer $Properties.TimeStampServer; | ||
} | ||
} | ||
} | ||
|
||
task CreateReleaseZip -depends StageReleaseZipFiles { | ||
$releaseDirectory = Resolve-Path (Join-Path . $Properties.ReleaseDirectory); | ||
$zipFileName = Join-Path $releaseDirectory ("{0}.zip" -f $packageName); | ||
Write-Verbose ("Zip release path '{0}'." -f $zipFileName); | ||
$zipFile = New-ZipArchive -Path $tempDirectory -DestinationPath $zipFileName; | ||
Write-Verbose ("Zip archive '{0}' created." -f $zipFile.FullName); | ||
} | ||
|
||
task CreateChocolateyReleaseDirectory { | ||
Remove-Item -Path $tempDirectory -Recurse -Force -ErrorAction SilentlyContinue; | ||
[ref] $null = New-Item -Path $tempDirectory -ItemType Container; | ||
[ref] $null = New-Item -Path "$tempDirectory\tools" -ItemType Container; | ||
} | ||
|
||
task StageChocolateyReleaseFiles -depends CreateChocolateyReleaseDirectory { | ||
## Create .nuspec | ||
$nuspec = $module | New-NugetNuspec -LicenseUrl $Properties.LicenseUrl; | ||
$nuspecFilename = "$($module.Name).nuspec"; | ||
$nuspecPath = Join-Path $tempDirectory $nuspecFilename; | ||
$nuspec.Save($nuspecPath); | ||
|
||
## Create \Tools\ChocolateyInstall.ps1 | ||
$chocolateyInstallPath = Join-Path (Get-Location) 'ChocolateyInstall.ps1'; | ||
Copy-Item -Path $chocolateyInstallPath -Destination "$tempDirectory\tools\" -Force; | ||
|
||
## Add Install-ChocolateyZipPackage to the ChocolateyInstall.ps1 file with the relevant download link | ||
$downloadUrl = "$($Properties.DownloadBaseUrl)/$packageName.zip"; | ||
$installChocolateyZipPackage = "Install-ChocolateyZipPackage '{0}' '{1}' '$userPSModulePath';" -f $packageName, $downloadUrl; | ||
Add-Content -Path "$tempDirectory\tools\ChocolateyInstall.ps1" -Value $installChocolateyZipPackage; | ||
} | ||
|
||
task CreateChocolateyReleasePackage -depends StageChocolateyReleaseFiles { | ||
|
||
$releaseDirectory = Resolve-Path (Join-Path . $Properties.ReleaseDirectory); | ||
Push-Location $tempDirectory; | ||
Invoke-Expression -Command ('Nuget Pack "{0}" -OutputDirectory "{1}"' -f $nuspecFileName, $releaseDirectory); | ||
Pop-Location; | ||
} | ||
|
||
task PushReleaseZip -depends CreateReleaseZip { | ||
Import-Module Posh-SSH; | ||
|
||
} | ||
|
||
task RemoveReleaseDirectory { | ||
Remove-Item -Path $tempDirectory -Recurse -Force -ErrorAction SilentlyContinue; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
## Try all user module paths and return first one | ||
foreach ($modulePath in $env:PSModulePath.Split(';')) { | ||
if ($modulePath -inotlike '*\Program Files\*' -and $modulePath -inotlike '*\Windows\*') { | ||
$userPSModulePath = $modulePath; | ||
break; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2014 Virtual Engine | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
The MIT License (MIT) | ||
Copyright (c) 2014 Virtual Engine Limited | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,38 @@ | ||
ziparchive | ||
========== | ||
|
||
PowerShell module for compressing and decompressing .ZIP archives | ||
## VirtualEngine.Compression ## | ||
A PowerShell module for compressing and decompressing archive files using only native .NET Framework 4.5 classes. | ||
|
||
* Create a .zip archive. | ||
* Add files to an existing .zip archive. | ||
* Extract all files from a .zip archive. | ||
* Extract individual files from a .zip archive. | ||
|
||
Requires __Powershell 3.0 or above__ and the __.NET Framework v4.5 or higher__. | ||
|
||
If you find it useful, unearth any bugs or have any suggestions for improvements, feel free to add an <a href="https://github.com/virtualengine/Compression/issues">issue</a> or place a comment at the project home page</a>. | ||
|
||
##### Screenshots | ||
![ScreenShot](./VirtualEngine.Compression.png?raw=true) | ||
|
||
##### Installation | ||
|
||
* Automatic (via Chocolatey): | ||
* Run 'cinst VirtualEngine-Compression'. | ||
* Run 'Import-Module VirtualEngine-Compression'. | ||
* Manual: | ||
* Download the latest release .zip. | ||
* Extract the .zip to your somewhere in the $PSModulePath, e.g. \Document\WindowsPowerShell\Modules\. | ||
* Run 'Import-Module VirtualEngine-Compression'. | ||
* If you want it to be loaded automatically when PowerShell starts, add the line above to your PowerShell profile (see $profile). | ||
|
||
#### Usage | ||
Refer to the built-in cmdlet help. | ||
|
||
* <b>Get a list of available cmdlets:</b> Get-Command -Module VirtualEngine.Compression | ||
* <b>Get an individual's cmdlet help:</b> Get-Help New-ZipArchive -Full | ||
|
||
##### Why? | ||
|
||
Because we couldn't find a PowerShell module that doesn't require 3rd party assemblies and we needed the ability to build .zip archives with <a href="https://github.com/psake/psake">Psake</a>. In addition, this module will become a dependency for other Virtual Engine modules and DSC resources in the near future. | ||
|
||
##### Implementation details | ||
Written in PowerShell :) |
Oops, something went wrong.