-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGetNovaModuleSelfUpdatePlan.ps1
More file actions
20 lines (17 loc) · 1.27 KB
/
Copy pathGetNovaModuleSelfUpdatePlan.ps1
File metadata and controls
20 lines (17 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
function Get-NovaModuleSelfUpdatePlan {
[CmdletBinding()]
param(
[Parameter(Mandatory)][pscustomobject]$InstalledModule,
[Parameter(Mandatory)][pscustomobject]$LookupResult,
[Parameter(Mandatory)][bool]$PrereleaseNotificationsEnabled
)
$planContext = Get-NovaModuleSelfUpdatePlanContext -LookupResult $LookupResult -PrereleaseNotificationsEnabled:$PrereleaseNotificationsEnabled
$stableVersion = Get-NovaAvailableSemanticVersion -VersionInfo $LookupResult.Stable
if (Test-NovaPrereleaseUpdateAvailable -LookupResult $LookupResult -InstalledVersion $InstalledModule.SemanticVersion -StableVersion $stableVersion -PrereleaseNotificationsEnabled $PrereleaseNotificationsEnabled) {
return ConvertTo-NovaModuleSelfUpdatePlan -InstalledModule $InstalledModule -PlanContext $planContext -TargetVersion $LookupResult.Prerelease.Version -PrereleaseTarget
}
if (Test-NovaStableUpdateAvailable -StableVersion $stableVersion -InstalledVersion $InstalledModule.SemanticVersion) {
return ConvertTo-NovaModuleSelfUpdatePlan -InstalledModule $InstalledModule -PlanContext $planContext -TargetVersion $LookupResult.Stable.Version
}
return ConvertTo-NovaModuleSelfUpdatePlan -InstalledModule $InstalledModule -PlanContext $planContext
}