Skip to content

Commit

Permalink
Add MakeZipWindows.ps1 PowerShell script
Browse files Browse the repository at this point in the history
  • Loading branch information
dagwieers committed Mar 28, 2019
1 parent 44a228c commit c484a0b
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 494 deletions.
1 change: 0 additions & 1 deletion MakeZipWindows.bat

This file was deleted.

33 changes: 33 additions & 0 deletions MakeZipWindows.ps1
@@ -0,0 +1,33 @@
#!powershell
#
$include_files = @( 'addon.py', 'addon.xml', 'LICENSE', 'README.md', 'service.py' )
$include_paths = @( 'resources/' )
$exclude_paths = @( 'test/' )

# Get addon metadata
[xml]$XmlDocument = Get-Content -LiteralPath 'addon.xml'
$name = $XmlDocument.addon.id
$version = $XmlDocument.addon.version
$git_hash = Invoke-Expression 'git rev-parse --short HEAD'
$zip_name = "$name-$version-$git_hash.zip"

# Remove file if it exists
if (Test-Path -LiteralPath $zip_name) {
Remove-Item -LiteralPath $zip_name
}

# Create ZIP file
Add-Type -AssemblyName System.IO.Compression

Write-Host '= Building new package'
$zip_file = [System.IO.Compression.ZipFile]::Open($zip_name, 'Create')
ForEach ($file in $include_files) {
[System.IO.Compression.ZipFileExtensions]::CreateEntryFromFile($zip_file, $file, "$name/$file")
}
ForEach ($path in $include_paths) {
Get-ChildItem -Recurse -File -LiteralPath $path | ForEach-Object {
[System.IO.Compression.ZipFileExtensions]::CreateEntryFromFile($zip_file, $_.FullName, "$name/$(Resolve-Path -Path $_.FullName -Relative)")
}
}
$zip_file.Dispose()
Write-Host "= Successfully wrote package as: $zip_name"
12 changes: 0 additions & 12 deletions packagemaker/Packagemaker.csproj

This file was deleted.

129 changes: 0 additions & 129 deletions packagemaker/Program.cs

This file was deleted.

15 changes: 0 additions & 15 deletions packagemaker/Properties/PublishProfiles/FolderProfile.pubxml

This file was deleted.

0 comments on commit c484a0b

Please sign in to comment.