Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/laurentdardenne/nuspec
Powershell DSL to create a nuspec file.
https://github.com/laurentdardenne/nuspec
dsl nuget nuspec powershell powershell-dsl
Last synced: about 1 month ago
JSON representation
Powershell DSL to create a nuspec file.
- Host: GitHub
- URL: https://github.com/laurentdardenne/nuspec
- Owner: LaurentDardenne
- Created: 2016-09-12T12:54:12.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-08-29T08:49:17.000Z (over 1 year ago)
- Last Synced: 2024-10-12T13:18:32.099Z (3 months ago)
- Topics: dsl, nuget, nuspec, powershell, powershell-dsl
- Language: PowerShell
- Homepage:
- Size: 43 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# Nuspec
Powershell DSL to create a nuspec file.
Only the following features are implemented : Files, DependenciesTo install this module :
```Powershell
$PSGalleryPublishUri = 'https://www.myget.org/F/ottomatt/api/v2/package'
$PSGallerySourceUri = 'https://www.myget.org/F/ottomatt/api/v2'Register-PSRepository -Name OttoMatt -SourceLocation $PSGallerySourceUri -PublishLocation $PSGalleryPublishUri #-InstallationPolicy Trusted
Install-Module PSNuspec -Repository OttoMatt
```To avoid the character encoding problems with nuspec files ('_utilisés_' instead '_utilisés_'), the scripts must be encoded with UTF8 nobom.
```Powershell
nuspec 'MyModule' '1.0' {
properties @{
Authors=$Env:USERNAME
Description='test'
title=''
summary=''
#owners=''
copyright='Copyleft'#default $false
requireLicenseAcceptance=$False
requireLicenseAcceptanceSpecified=$False#default en-US'
language='en-US'#PSData
licenseUrl='https://creativecommons.org/licenses/by-nc-sa/4.0/'
projectUrl='https://github.com/LaurentDardenne/'
iconUrl='https://github.com/LaurentDardenne/Nuspec/blob/master/Icon/Nuspec.png'
releaseNotes=''
tags=$null
}
files {
file -src 'C:\temp\Remove-Conditionnal.ps1'
file -src 'C:\temp\Replace-String.ps1'
}
}|Save-Nuspec -FileName c:\temp\Test.nuspec
```
It is possible to create nested nuspec :
```Powershell
$Nuspecs=Nuspec 'Module one' '1.0' {
properties @{
Description='test'
Authors=$Env:USERNAME
}dependencies {
dependency 'Machin' '1.0'
dependency 'Truc' '2.0'Nuspec 'Module two' '0.8' {
properties @{
Authors=$Env:USERNAME
Description='test'
}dependencies {
dependency 'Bidule' '1.2'
dependency 'Pester' '3.9'
}
}
}
}
```
$Nuspecs contains two objects :
```Powershell
$nuspecs[0].metadata
```
```
id : Module two
version : 0.8
...
dependencies : {Bidule, Pester}
```
The dependencies list of the first nupsec object contains the nested nuspec as a dependency :
```Powershell
$nuspecs[1].metadata
```
```
id : Module one
version : 1.0
...
dependencies : {Machin, Truc, Module two}
```
The 'Nuspec' bloc create an instance of _[NugetSchema.package]_, then the Save-Nuspec function create a XML file from the C# instance.
See the [XMLObject module](https://github.com/LaurentDardenne/XMLObject).To push one or more packages :
```Powershell
$NuspecDelivery='C:\temp'$Result=nuspec 'PSNuspec' 1.0.0 {
properties @{
Authors='Dardenne Laurent'
...
}$Result|
Push-nupkg -Path $NuspecDelivery -Source 'https://www.myget.org/F/ottomatt/api/v2/package' -Apikey $Key
```