Skip to content

Commit

Permalink
Minor refactoring on AUVersion
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Démoulins committed Nov 6, 2017
1 parent 2e791e9 commit 78ce40c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions AU/Private/AUVersion.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ class AUVersion : System.IComparable {
}
}

[AUVersion] WithVersion([version] $version) { return [AUVersion]::new($version, $this.Prerelease, $this.BuildMetadata) }

[int] CompareTo($obj) {
if ($obj -eq $null) { return 1 }
if ($obj -isnot [AUVersion]) { throw "AUVersion expected: $($obj.GetType())" }
Expand Down
2 changes: 1 addition & 1 deletion AU/Public/Update-Package.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ function Update-Package {

$build = if ($v.Build -eq -1) {0} else {$v.Build}
$v = [version] ('{0}.{1}.{2}.{3}' -f $v.Major, $v.Minor, $build, $d)
$package.RemoteVersion = [AUVersion]::new($v, $nuspecVersion.Prerelease, $nuspecVersion.BuildMetadata).ToString()
$package.RemoteVersion = $nuspecVersion.WithVersion($v).ToString()
$Latest.Version = $package.RemoteVersion -as $Latest.Version.GetType()
}

Expand Down

0 comments on commit 78ce40c

Please sign in to comment.