Skip to content

Commit

Permalink
When a stream is updated, a package always refers now to the newest u…
Browse files Browse the repository at this point in the history
…pdated stream information

Previously, a package always used to refer to the newest stream whether it has been updated or not
  • Loading branch information
Thomas Démoulins committed Jan 2, 2019
1 parent 5770b88 commit 9083828
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
6 changes: 5 additions & 1 deletion AU/Public/Update-Package.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,11 @@ function Update-Package {
}
$package.Updated = $false
$package.Streams = $allStreams
$package.Streams.Values | ? { $_.Updated } | % { $package.Updated = $true }
$package.Streams.Values | ? { $_.Updated } | % {
$package.NuspecVersion = $_.NuspecVersion
$package.RemoteVersion = $_.RemoteVersion
$package.Updated = $true
}
} else {
'' | result
set_latest $res $package.NuspecVersion
Expand Down
23 changes: 15 additions & 8 deletions tests/Update-Package.Streams.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,14 @@ Describe 'Update-Package using streams' -Tag updatestreams {
$res = update

$res.Updated | Should Be $true
$res.Streams.'1.2'.RemoteVersion | Should Be 1.2.4
$res.Streams.'1.3'.RemoteVersion | Should Be 1.3.1
$res.Streams.'1.4'.RemoteVersion | Should Be 1.4-beta1
$res.NuspecVersion | Should Be 1.2.3
$res.RemoteVersion | Should Be 1.2.4
$res.Streams.'1.2'.NuspecVersion | Should Be 1.2.3
$res.Streams.'1.2'.RemoteVersion | Should Be 1.2.4
$res.Streams.'1.3'.NuspecVersion | Should Be 1.3.1
$res.Streams.'1.3'.RemoteVersion | Should Be 1.3.1
$res.Streams.'1.4'.NuspecVersion | Should Be 1.4-beta1
$res.Streams.'1.4'.RemoteVersion | Should Be 1.4-beta1
$res.Result[-1] | Should Be 'Package updated'
(nuspec_file).package.metadata.version | Should Be 1.2.4
(json_file).'1.2' | Should Be 1.2.4
Expand All @@ -175,21 +180,23 @@ Describe 'Update-Package using streams' -Tag updatestreams {
}

It 'updates package when multiple remote versions are higher' {
get_latest -Version 1.4.0
get_latest -Version 1.3.2

$res = update

$res.Updated | Should Be $true
$res.NuspecVersion | Should Be 1.3.1
$res.RemoteVersion | Should Be 1.3.2
$res.Streams.'1.2'.NuspecVersion | Should Be 1.2.3
$res.Streams.'1.2'.RemoteVersion | Should Be 1.2.4
$res.Streams.'1.3'.NuspecVersion | Should Be 1.3.1
$res.Streams.'1.3'.RemoteVersion | Should Be 1.3.1
$res.Streams.'1.3'.RemoteVersion | Should Be 1.3.2
$res.Streams.'1.4'.NuspecVersion | Should Be 1.4-beta1
$res.Streams.'1.4'.RemoteVersion | Should Be 1.4.0
$res.Streams.'1.4'.RemoteVersion | Should Be 1.4-beta1
$res.Result[-1] | Should Be 'Package updated'
(json_file).'1.2' | Should Be 1.2.4
(json_file).'1.3' | Should Be 1.3.1
(json_file).'1.4' | Should Be 1.4.0
(json_file).'1.3' | Should Be 1.3.2
(json_file).'1.4' | Should Be 1.4-beta1
}

It "does not update the package when remote version is not higher" {
Expand Down

0 comments on commit 9083828

Please sign in to comment.