diff --git a/bin/checkver.ps1 b/bin/checkver.ps1 index 70d356079..ecce76085 100644 --- a/bin/checkver.ps1 +++ b/bin/checkver.ps1 @@ -94,7 +94,7 @@ Get-Event | ForEach-Object { $Queue | ForEach-Object { $name, $json = $_ - $substitutions = get_version_substitutions $json.version + $substitutions = Get-VersionSubstitution $json.version $wc = New-Object Net.Webclient if ($json.checkver.useragent) { diff --git a/lib/autoupdate.ps1 b/lib/autoupdate.ps1 index 81b31023e..d3d0e83e5 100644 --- a/lib/autoupdate.ps1 +++ b/lib/autoupdate.ps1 @@ -324,26 +324,34 @@ function update_manifest_prop([String] $prop, $json, [Hashtable] $substitutions) } } -function get_version_substitutions([String] $version, [Hashtable] $customMatches) { - $firstPart = $version.Split('-') | Select-Object -first 1 - $lastPart = $version.Split('-') | Select-Object -last 1 +function Get-VersionSubstitution { + param ( + [String] + $Version, + [Hashtable] + $CustomMatches + ) + + $firstPart = $Version.Split('-') | Select-Object -First 1 + $lastPart = $Version.Split('-') | Select-Object -Last 1 $versionVariables = @{ - '$version' = $version; - '$underscoreVersion' = ($version -replace "\.", "_"); - '$dashVersion' = ($version -replace "\.", "-"); - '$cleanVersion' = ($version -replace "\.", ""); - '$majorVersion' = $firstPart.Split('.') | Select-Object -first 1; - '$minorVersion' = $firstPart.Split('.') | Select-Object -skip 1 -first 1; - '$patchVersion' = $firstPart.Split('.') | Select-Object -skip 2 -first 1; - '$buildVersion' = $firstPart.Split('.') | Select-Object -skip 3 -first 1; + '$version' = $Version; + '$dotVersion' = ($Version -replace '[._-]', '.'); + '$underscoreVersion' = ($Version -replace '[._-]', '_'); + '$dashVersion' = ($Version -replace '[._-]', '-'); + '$cleanVersion' = ($Version -replace '[._-]', ''); + '$majorVersion' = $firstPart.Split('.') | Select-Object -First 1; + '$minorVersion' = $firstPart.Split('.') | Select-Object -Skip 1 -First 1; + '$patchVersion' = $firstPart.Split('.') | Select-Object -Skip 2 -First 1; + '$buildVersion' = $firstPart.Split('.') | Select-Object -Skip 3 -First 1; '$preReleaseVersion' = $lastPart; } - if($version -match "(?
\d+\.\d+(?:\.\d+)?)(?