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

fix(checkver): Correct error messages #6024

Merged
merged 1 commit into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
- **core:** Search for Git executable instead of any cmdlet ([#5998](https://github.com/ScoopInstaller/Scoop/issues/5998))
- **core:** Use correct path in 'bash' ([#6006](https://github.com/ScoopInstaller/Scoop/issues/6006))
- **core:** Limit the number of commands to get when search for git executable ([#6013](https://github.com/ScoopInstaller/Scoop/pull/6013))
- **checkver:** Correct error messages ([#6024](https://github.com/ScoopInstaller/Scoop/issues/6024))

### Code Refactoring

Expand Down
10 changes: 6 additions & 4 deletions bin/checkver.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,10 @@ while ($in_progress -gt 0) {
}
$page = (New-Object System.IO.StreamReader($ms, (Get-Encoding $wc))).ReadToEnd()
}
$source = $url
if ($script) {
$page = Invoke-Command ([scriptblock]::Create($script -join "`r`n"))
$source = 'the output of script'
}

if ($jsonpath) {
Expand All @@ -310,7 +312,7 @@ while ($in_progress -gt 0) {
$ver = json_path_legacy $page $jsonpath
}
if (!$ver) {
next "couldn't find '$jsonpath' in $url"
next "couldn't find '$jsonpath' in $source"
continue
}
}
Expand All @@ -332,7 +334,7 @@ while ($in_progress -gt 0) {
# Getting version from XML, using XPath
$ver = $xml.SelectSingleNode($xpath, $nsmgr).'#text'
if (!$ver) {
next "couldn't find '$($xpath -replace 'ns:', '')' in $url"
next "couldn't find '$($xpath -replace 'ns:', '')' in $source"
continue
}
}
Expand Down Expand Up @@ -366,13 +368,13 @@ while ($in_progress -gt 0) {
$ver = $matchesHashtable['version']
}
} else {
next "couldn't match '$regexp' in $url"
next "couldn't match '$regexp' in $source"
continue
}
}

if (!$ver) {
next "couldn't find new version in $url"
next "couldn't find new version in $source"
continue
}
}
Expand Down