chocolatey / chocolatey-licensed-issues

Issues for Licensed Editions of Chocolatey
19 stars 13 forks source link

sync - nuspec generation option for custom template #5

Open rismoney opened 7 years ago

rismoney commented 7 years ago

What You Are Seeing?

choco sync -r builds with a template, that seems to be initially exported to C:\programdata\chocolatey\templates\newfileinstaller\file.nuspec

What is Expected?

I would prefer an alternate template to be an arg.

Use case: (we want no comment fields in xml files. we know what we're doing )

┆Issue is synchronized with this GitLab issue by Unito

ferventcoder commented 7 years ago

Feature requests can use plain English. 👍 - see the template below the bug template. ;)

rismoney commented 7 years ago

I figured I would post my short term workaround, as it could help someone else:

Get-ChildItem -Recurse -Filter *.nuspec | ForEach-Object {
$old = "$($_.Directory)\$($_.basename).old"
mv $_.FullName $old
C:\sync\xml.exe c14n --without-comments $old > $_.FullName
# easily purge whitespace and manage indentation via posh
[xml]$xmlfile = gc $_.FullName
$xmlfile.Save("$($_.Fullname)")
}

[1] this solution uses xmlstarlet and drops it in sync folder (ran from root C:\ to yield C:\sync [2] xml.exe (aka xmlstarlet) can be found here: https://sourceforge.net/projects/xmlstar/files/xmlstarlet/1.6.1/

Hope this helps clean things up for people wanting to repackage w/o comment cruft.