Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(scoop-update): Properly summarize failed updates #177

Merged
merged 3 commits into from
Jul 17, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
feat(scoop-update): Summary all failed installations
TODO: Properly test the single ignore
  • Loading branch information
Ash258 committed Jul 15, 2021
commit c37ea758a781a3503e367f50c3b7f3e90b731dfd
9 changes: 4 additions & 5 deletions lib/Update.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -240,15 +240,13 @@ function Update-App {

# TODO: Could this ever happen?
if (!$Force -and ($oldVersion -eq $version)) {
if (!$quiet) { Write-UserMessage -Message "The Latest version of '$App' ($version) is already installed." -Warning }
return
throw [ScoopException] "The Latest version of '$App' ($version) is already installed." # TerminatingError thrown
}

# TODO:???
# TODO: Case when bucket no longer have this application?
if (!$version) {
Write-UserMessage -Message "No manifest available for '$App'" -Err
return
throw [ScoopException] "No manifest available for '$App'" # TerminatingError thrown
}

$manifest = manifest $App $bucket $url
Expand Down Expand Up @@ -291,7 +289,7 @@ function Update-App {
#endregion Workaround of #2220

$result = Uninstall-ScoopApplication -App $App -Global:$Global
if ($result -eq $false) { return }
if ($result -eq $false) { throw [ScoopException] 'Ignore' }

# Rename current version to .old if same version is installed
if ($Force -and ($oldVersion -eq $version)) {
Expand All @@ -307,6 +305,7 @@ function Update-App {
}
}

# TODO: Adopt Resolve-ManifestInformation???
$toUpdate = if ($install.url) { $install.url } else { "$bucket/$App" }

# Error catching should be handled on upper scope
Expand Down
11 changes: 9 additions & 2 deletions libexec/scoop-install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,15 @@ foreach ($app in $apps) {

show_suggestions $suggested

if ($failedApplications) { Write-UserMessage -Message "These applications failed to install: $($failedApplications -join ', ')" -Err }
if ($failedDependencies) { Write-UserMessage -Message "These dependencies failed to install: $($failedDependencies -join ', ')" -Err }
if ($failedApplications) {
$pl = pluralize $failedApplications.Count 'This application' 'These applications'
Write-UserMessage -Message "$pl failed to install: $($failedApplications -join ', ')" -Err
}

if ($failedDependencies) {
$pl = pluralize $failedDependencies.Count 'This dependency' 'These dependencies'
Write-UserMessage -Message "$pl failed to install: $($failedDependencies -join ', ')" -Err
}

if ($problems -gt 0) { $exitCode = 10 + $problems }

Expand Down
5 changes: 4 additions & 1 deletion libexec/scoop-update.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,10 @@ if (!$Applications) {
}
}

if ($failedApplications) { Write-UserMessage -Message "These applications failed to update: $($failedApplications -join ', ')" -Err }
if ($failedApplications) {
$pl = pluralize $failedApplications.Count 'This application' 'These applications'
Write-UserMessage -Message "$pl failed to update: $($failedApplications -join ', ')" -Err
}

if ($Problems -gt 0) { $ExitCode = 10 + $Problems }

Expand Down