Skip to content
This repository has been archived by the owner on Nov 18, 2024. It is now read-only.

Commit

Permalink
(maint) Fix build script
Browse files Browse the repository at this point in the history
  • Loading branch information
jibedoubleve committed Sep 11, 2020
1 parent 6d7b39e commit ad5f9e6
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions chocolatey/build-package.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@ $publishDir = "..\Publish"
$installer = "$publishDir\logreader.*.setup.exe"
$outputDir = "$publishDir\logreader"

$pattern = "logreader\.(\d{1,2}\.\d{1,2}\.\d{1,2}).*((\.|)\d{0,2})\.setup.exe"

<################################################################################
# FUNCTIONS
################################################################################>
function GetSemVersion() {


if ($items = Get-ChildItem $installer) {
$items[0].Name -match "logreader\.(\d{1,2}\.\d{1,2}\.\d{1,2}).*\.(\d{1,2})\.setup.exe" > $null
$items[0].Name -match $pattern > $null
return "$($Matches[1])$(GetMode).$($Matches[2])"
}
else {
Expand All @@ -26,8 +28,8 @@ function GetSemVersion() {
}
function GetVersion() {
if ($items = Get-ChildItem $installer) {
$items[0].Name -match "logreader\.(\d{1,2}\.\d{1,2}\.\d{1,2}).*\.(\d{1,2})\.setup.exe" > $null
return "$($Matches[1]).$($Matches[2])"
$items[0].Name -match $pattern > $null
return "$($Matches[1])$($Matches[2])"
}
else {
throw "Cannot extract version: Cannot find file '$installer'. [PWD] $pwd"
Expand Down Expand Up @@ -64,7 +66,7 @@ $instScr = "$outputDir\tools\chocolateyinstall.ps1"
$version = GetVersion
$semVersion = GetSemVersion

write-host $version -ForegroundColor Cyan
write-host "Version: $version" -ForegroundColor Cyan

$(Get-Content $nuspec) -replace "<version>.*</version>", "<version>$version</version>" | Set-Content -Path $nuspec
$(Get-Content $instScr) -replace "toolsDir 'logreader.(.*).setup.exe'", "toolsDir 'logreader.$semVersion.setup.exe'" | Set-Content -Path $instScr
Expand Down

0 comments on commit ad5f9e6

Please sign in to comment.