Skip to content

Commit

Permalink
Add support for common properties shared between all streams
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Démoulins committed Nov 6, 2017
1 parent 972cc01 commit 2e791e9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions AU/Public/Update-Package.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,9 @@ function Update-Package {
$streams = $res.Streams
}

$res.Keys | ? { $_ -ne 'Streams' } | % { $global:au_Latest.Remove($_) }
$global:au_Latest += $res

$streams.Keys | ? { !$Include -or $_ -in $Include } | sort { [AUVersion] $_ } | % {
$stream = $streams[$_]

Expand Down
8 changes: 7 additions & 1 deletion tests/Update-Package.Streams.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Describe 'Update-Package using streams' -Tag updatestreams {
if ($Checksum32) { $s += @{ Checksum32 = $Checksum32 } }
$streams.Add($stream, $s)
}
$command = "function global:au_GetLatest { @{ Streams = @{`n"
$command = "function global:au_GetLatest { @{ Fake = 1; Streams = @{`n"
foreach ($item in $streams.Keys) {
$command += "'$item' = @{Version = '$($streams.$item.Version)'; URL32 = '$($streams.$item.URL32)'"
if ($streams.$item.Checksum32) { $command += "; Checksum32 = '$($streams.$item.Checksum32)'" }
Expand Down Expand Up @@ -290,6 +290,12 @@ Describe 'Update-Package using streams' -Tag updatestreams {
$return_value = @()
{ update } | Should Throw "returned nothing"
}

It "supports properties defined outside streams" {
get_latest -Version 1.4.0
function au_BeforeUpdate { $global:Latest.Fake | Should Be 1 }
update
}
}

Context 'Before and after update' {
Expand Down

0 comments on commit 2e791e9

Please sign in to comment.