Skip to content

Commit dac9ba0

Browse files
committed
Merge branch 'hotfix/0.4.1'
2 parents 1c03f3d + ada5497 commit dac9ba0

File tree

6 files changed

+298
-238
lines changed

6 files changed

+298
-238
lines changed

Wormies-AU-Helpers/public/Get-FixVersion.ps1

+8-5
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@
3737
version number isn't a 4-part version.
3838
3939
.EXAMPLE
40-
Get-FixVersion -Version '24.0.0.195'
40+
PS> Get-FixVersion -Version '24.0.0.195'
4141
4242
will output `24.0.0.19501` if the
4343
nuspec version is equal to `24.0.0.195` or `24.0.0.19500` and
4444
`$global:au_Force` is set to `$true`
4545
4646
.EXAMPLE
47-
Get-FixVersion -Version '5.0-beta'
47+
PS> Get-FixVersion -Version '5.0-beta'
4848
4949
will output `5.0-beta-20171123` (the current date)
5050
@@ -133,16 +133,19 @@ function Get-FixVersion() {
133133
if ($mainVersion -ge $belowVersion -and ($preRelease -ge $belowPreRelease)) {
134134
if (!$preRelease -and ([string]$existingVersion).StartsWith($mainVersion)) {
135135
return $existingVersion
136-
}elseif (([string]$existingVersion).StartsWith("${mainVersion}${preRelease}")) {
136+
}
137+
elseif (([string]$existingVersion).StartsWith("${mainVersion}${preRelease}")) {
137138
if ($global:au_Force -ne $true) { return $existingVersion }
138-
}else {
139+
}
140+
else {
139141
return $Version
140142
}
141143
}
142144
elseif ($mainVersion -eq $belowVersion -and !$preRelease -and $belowVersion) {
143145
if (([string]$existingVersion).StartsWith($mainVersion)) {
144146
return $existingVersion
145-
} else {
147+
}
148+
else {
146149
return $Version
147150
}
148151
}

Wormies-AU-Helpers/public/Update-Metadata.ps1

+59-46
Original file line numberDiff line numberDiff line change
@@ -2,50 +2,58 @@ $ErrorActionPreference = 'Stop'
22

33
<#
44
.SYNOPSIS
5-
Updates the metadata nuspec file with the specified information.
5+
Updates the metadata nuspec file with the specified information.
66
77
.DESCRIPTION
8-
When a key and value is specified, update the metadata element with the specified key
9-
and the corresponding value in the specified NuspecFile.
10-
Singlular metadata elements are the only ones changed at this time.
8+
When a key and value is specified, update the metadata element with the specified key
9+
and the corresponding value in the specified NuspecFile.
10+
Singlular metadata elements are the only ones changed at this time.
1111
1212
.PARAMETER key
13-
The element that should be updated in the metadata section.
13+
The element that should be updated in the metadata section.
1414
1515
.PARAMETER value
16-
The value to update with.
16+
The value to update with.
1717
1818
.PARAMETER NuspecFile
19-
The metadata/nuspec file to update
19+
The metadata/nuspec file to update
2020
2121
.EXAMPLE
22-
Update-Metadata -key releaseNotes -value "https://github.com/majkinetor/AU/releases/latest"
22+
PS> Update-Metadata -key releaseNotes -value "https://github.com/majkinetor/AU/releases/latest"
2323
2424
.EXAMPLE
25-
Update-Metadata -key releaseNotes -value "https://github.com/majkinetor/AU/releases/latest" -NuspecFile ".\package.nuspec"
25+
PS> Update-Metadata -key releaseNotes -value "https://github.com/majkinetor/AU/releases/latest" -NuspecFile ".\package.nuspec"
2626
2727
.EXAMPLE
28-
This is an example of changing the Title of the nuspec file
29-
Update-Metadata -data @{ title = 'My Awesome Title' }
30-
- or -
31-
@{ title = 'My Awesome Title' } | Update-Metadata
28+
PS> @{ title = 'My Awesome Title' } | Update-Metadata
29+
30+
This is an example of changing the Title of the nuspec file
31+
Update-Metadata -data @{ title = 'My Awesome Title' }
3232
3333
.EXAMPLE
34-
This is an example of changing the id and version attributes for the dependency key
35-
Update-Metadata -data @{ dependency = 'kb2919355|1.0.20160915' }
36-
- or -
37-
@{ dependency = 'kb2919355|1.0.20160915' } | Update-Metadata
34+
PS> Update-Metadata -data @{ dependency = 'kb2919355|1.0.20160915' }
35+
36+
This is an example of changing the id and version attributes for the dependency key
3837
3938
.EXAMPLE
40-
This is an example of changing the src and target attributes
41-
Update-Metadata -data @{ file = 'tools\**,tools' }
42-
- or -
43-
@{ file = 'tools\**|tools' } | Update-Metadata
39+
PS> @{ dependency = 'kb2919355|1.0.20160915' } | Update-Metadata
40+
41+
.EXAMPLE
42+
PS> Update-Metadata -data @{ file = 'tools\**,tools' }
43+
44+
This is an example of changing the src and target attributes
4445
4546
.EXAMPLE
46-
This is an example of changing the file src and target attributes for the first file element in the nuspec file.
47-
If only one file element is found the change value is omitted.
48-
@{ file = 'tools\**|tools,1' } | Update-Metadata
47+
PS> @{ file = 'tools\**|tools' } | Update-Metadata
48+
49+
.EXAMPLE
50+
PS> @{ file = 'tools\**|tools,1' } | Update-Metadata
51+
52+
This is an example of changing the file src and target attributes for the first file element in the nuspec file.
53+
If only one file element is found the change value is omitted.
54+
55+
.INPUTS
56+
A hashtable of key+value pairs can be used instead of specifically use an argument.
4957
5058
.NOTES
5159
Will now show a warning if the specified key doesn't exist in the nuspec file.
@@ -56,6 +64,8 @@ If only one file element is found the change value is omitted.
5664
While the parameter `NuspecFile` accepts globbing patterns,
5765
it is expected to only match a single file.
5866
67+
The ability to update the file and dependency metadata was included in version 0.4.0.
68+
5969
.LINK
6070
https://wormiecorp.github.io/Wormies-AU-Helpers/docs/functions/update-metadata
6171
#>
@@ -66,7 +76,7 @@ function Update-Metadata {
6676
[Parameter(Mandatory = $true, ParameterSetName = "Single")]
6777
[string]$value,
6878
[Parameter(Mandatory = $true, ParameterSetName = "Multiple", ValueFromPipeline = $true)]
69-
[hashtable]$data = @{$key = $value},
79+
[hashtable]$data = @{ $key = $value },
7080
[ValidateScript( { Test-Path $_ })]
7181
[SupportsWildcards()]
7282
[string]$NuspecFile = ".\*.nuspec"
@@ -84,44 +94,46 @@ function Update-Metadata {
8494
'^(file)$' {
8595
$metaData = "files"
8696
$NodeGroup = $nu.package.$metaData
87-
$NodeData,[int]$change = $data[$_] -split (",")
97+
$NodeData, [int]$change = $data[$_] -split (",")
8898
$NodeCount = $nu.package.$metaData.ChildNodes.Count
89-
$src,$target,$exclude = $NodeData -split ("\|")
99+
$src, $target, $exclude = $NodeData -split ("\|")
90100
$NodeAttributes = [ordered] @{
91-
"src" = $src
92-
"target" = $target
93-
"exclude" = $exclude
94-
}
95-
$change = @{$true="0";$false=($change - 1)}[ ([string]::IsNullOrEmpty($change)) ]
101+
"src" = $src
102+
"target" = $target
103+
"exclude" = $exclude
104+
}
105+
$change = @{$true = "0"; $false = ($change - 1) }[ ([string]::IsNullOrEmpty($change)) ]
96106
if ($NodeCount -eq 3) {
97107
$NodeGroup = $NodeGroup."$_"
98-
} else {
108+
}
109+
else {
99110
$NodeGroup = $NodeGroup.$_[$change]
100111
}
101112
}
102113
'^(dependency)$' {
103-
$MetaNode = $_ -replace("y","ies")
114+
$MetaNode = $_ -replace ("y", "ies")
104115
$metaData = "metadata"
105-
$NodeData,[int]$change = $data[$_] -split (",")
116+
$NodeData, [int]$change = $data[$_] -split (",")
106117
$NodeGroup = $nu.package.$metaData.$MetaNode
107118
$NodeCount = $nu.package.$metaData.$MetaNode.ChildNodes.Count
108-
$id,$version,$include,$exclude = $NodeData -split ("\|")
119+
$id, $version, $include, $exclude = $NodeData -split ("\|")
109120
$NodeAttributes = [ordered] @{
110-
"id" = $id
111-
"version" = $version
112-
"include" = $include
113-
"exclude" = $exclude
114-
}
115-
$change = @{$true="0";$false=($change - 1)}[ ([string]::IsNullOrEmpty($change)) ]
121+
"id" = $id
122+
"version" = $version
123+
"include" = $include
124+
"exclude" = $exclude
125+
}
126+
$change = @{$true = "0"; $false = ($change - 1) }[ ([string]::IsNullOrEmpty($change)) ]
116127
if ($NodeCount -eq 3) {
117128
$NodeGroup = $NodeGroup."$_"
118-
} else {
129+
}
130+
else {
119131
$NodeGroup = $NodeGroup.$_[$change]
120132
}
121133
}
122134
default {
123135
if ( $nu.package.metadata."$_" ) {
124-
$nu.package.metadata."$_" = $data[$_]
136+
$nu.package.metadata."$_" = [string]$data[$_]
125137
}
126138
else {
127139
Write-Warning "$_ does not exist on the metadata element in the nuspec file"
@@ -139,12 +151,13 @@ function Update-Metadata {
139151
if (!([string]::IsNullOrEmpty($NodeAttributes[$attrib])) ) {
140152
if (![string]::IsNullOrEmpty( $NodeGroup.Attributes ) ) {
141153
$NodeGroup.SetAttribute($attrib, $NodeAttributes[$attrib] )
142-
} else {
154+
}
155+
else {
143156
Write-Warning "Attribute $attrib not defined for $_ in the nuspec file"
144157
}
145158
}
146159
}
147-
}
160+
}
148161
}
149162

150163
$utf8NoBom = New-Object System.Text.UTF8Encoding($false)

docs/input/_Bottom.cshtml

+7-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
<a href="https://github.com/WormieCorp/Wormies-AU-Helpers" target="_blank"><i class="fa fa-github"></i> GitHub</a>
33
</div>
44

5-
<script src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/4.1.0/anchor.min.js" integrity="sha256-lZaRhKri35AyJSypXXs4o6OPFTbTmUoltBbDCbdzegg=" crossorigin="anonymous"></script>
6-
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/1.7.1/clipboard.min.js" integrity="sha256-Daf8GuI2eLKHJlOWLRR/zRy9Clqcj4TUSumbxYH9kGI=" crossorigin="anonymous"></script>
7-
<script type="text/javascript" src="@Context.GetLink("/assets/js/setup.min.js")" data-assets-dir="@Context.GetLink("/assets")"></script>
5+
<script src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/4.3.0/anchor.min.js"
6+
integrity="sha512-G2OGlm41XXw+fcgDcRPjVYEn7qCY6qiKWNqDGT37SnKh0qtRXTuKZ5/UQR0kDN0PZRNWcGExd3lAeqEH0I36bQ=="
7+
crossorigin="anonymous"></script>
8+
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/1.7.1/clipboard.min.js"
9+
integrity="sha256-Daf8GuI2eLKHJlOWLRR/zRy9Clqcj4TUSumbxYH9kGI=" crossorigin="anonymous"></script>
10+
<script type="text/javascript" src="@Context.GetLink("/assets/js/setup.min.js")"
11+
data-assets-dir="@Context.GetLink("/assets")"></script>

0 commit comments

Comments
 (0)