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
Prev Previous commit
Next Next commit
new-issueprompt wrapper
  • Loading branch information
Ash258 committed Jul 16, 2021
commit 9f6d5051342e5a6cc6f86df4678763a68b69ee58
16 changes: 16 additions & 0 deletions lib/Helpers.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ function New-IssuePrompt {
param([String] $Application, [String] $Bucket, [String] $Title, [String[]] $Body)

$Bucket = $Bucket.Trim()
# TODO: Adopt-ManifestResolveInformation
$app, $manifest, $Bucket, $url = Find-Manifest $Application $Bucket
$url = known_bucket_repo $Bucket
$bucketPath = Join-Path $SCOOP_BUCKETS_DIRECTORY $Bucket
Expand Down Expand Up @@ -357,6 +358,21 @@ function New-IssuePrompt {
Write-UserMessage -Message "$msg`n$url" -Color 'DarkRed'
}

function New-IssuePromptFromException {
param(
[String] $ExceptionMessage,
[String] $Application,
[AllowNull()]
[String] $Bucket
)
process {
$title, $body = $ExceptionMessage -split '\|-'
if (!$body) { $body = $title }
if ($body -ne 'Ignore') { Write-UserMessage -Message $body -Err }
if ($title -ne 'Ignore' -and ($title -ne $body)) { New-IssuePrompt -Application $Application -Bucket $Bucket -Title $title -Body $body }
}
}

function Get-NotePropertyEnumerator {
<#
.SYNOPSIS
Expand Down
9 changes: 1 addition & 8 deletions libexec/scoop-update.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,9 @@ if (!$Applications) {
Update-App -App $out[0] -Global:$out[1] -Suggested @{ } -Quiet:$Quiet -Independent:$Independent -SkipCache:(!$UseCache) -SkipHashCheck:(!$CheckHash)
} catch {
++$Problems

$failedApplications += $out[0]

$title, $body = $_.Exception.Message -split '\|-'
if (!$body) { $body = $title }
Write-UserMessage -Message $body -Err
debug $_.InvocationInfo
if ($title -ne 'Ignore' -and ($title -ne $body)) { New-IssuePrompt -Application $out[0] -Bucket $out[2] -Title $title -Body $body }

continue
New-IssuePromptFromException -ExceptionMessage $_.Exception.Message -Application $out[0] -Bucket $out[2]
}
}
}
Expand Down