Skip to content

Commit 48f7935

Browse files
authored
fix(manifest): Correct source of manifest (#5575)
1 parent 5328bef commit 48f7935

File tree

6 files changed

+23
-23
lines changed

6 files changed

+23
-23
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
- **scoop-checkup:** Change the message level of helpers from ERROR to WARN ([#5549](https://github.com/ScoopInstaller/Scoop/issues/5614))
3636
- **scoop-(un)hold:** Correct output the messages when manifest not found, (already|not) held ([#5519](https://github.com/ScoopInstaller/Scoop/issues/5519))
3737
- **scoop-update:** Change error message to a better instruction ([#5677](https://github.com/ScoopInstaller/Scoop/issues/5677))
38+
- **manifest:** Correct source of manifest ([#5575](https://github.com/ScoopInstaller/Scoop/issues/5575))
3839
- **shim:** Check literal path in `Get-ShimPath` ([#5680](https://github.com/ScoopInstaller/Scoop/issues/5680))
3940
- **shim:** Avoid unexpected output of `list` subcommand ([#5681](https://github.com/ScoopInstaller/Scoop/issues/5681))
4041
- **scoop-reset:** Don't abort when multiple apps are passed and an app is running ([#5687](https://github.com/ScoopInstaller/Scoop/issues/5687))

lib/depends.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ function Get-Dependency {
3737

3838
if (!$manifest) {
3939
if (((Get-LocalBucket) -notcontains $bucket) -and $bucket) {
40-
warn "Bucket '$bucket' not installed. Add it with 'scoop bucket add $bucket' or 'scoop bucket add $bucket <repo>'."
40+
warn "Bucket '$bucket' not added. Add it with $(if($bucket -in (known_buckets)) { "'scoop bucket add $bucket' or " })'scoop bucket add $bucket <repo>'."
4141
}
42-
abort "Couldn't find manifest for '$AppName'$(if(!$bucket) { '.' } else { " from '$bucket' bucket." })"
42+
abort "Couldn't find manifest for '$AppName'$(if($bucket) { " from '$bucket' bucket" } elseif($url) { " at '$url'" })."
4343
}
4444

4545
$deps = @(Get-InstallationHelper $manifest $Architecture) + @($manifest.depends) | Select-Object -Unique

lib/install.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function install_app($app, $architecture, $global, $suggested, $use_cache = $tru
99
$app, $manifest, $bucket, $url = Get-Manifest $app
1010

1111
if(!$manifest) {
12-
abort "Couldn't find manifest for '$app'$(if($url) { " at the URL $url" })."
12+
abort "Couldn't find manifest for '$app'$(if($bucket) { " from '$bucket' bucket" } elseif($url) { " at '$url'" })."
1313
}
1414

1515
$version = $manifest.version
@@ -43,7 +43,7 @@ function install_app($app, $architecture, $global, $suggested, $use_cache = $tru
4343
return
4444
}
4545
}
46-
Write-Output "Installing '$app' ($version) [$architecture]$(if ($bucket) { " from $bucket bucket" })"
46+
Write-Output "Installing '$app' ($version) [$architecture]$(if ($bucket) { " from '$bucket' bucket" } else { " from '$url'" })"
4747

4848
$dir = ensure (versiondir $app $version $global)
4949
$original_dir = $dir # keep reference to real (not linked) directory

lib/manifest.ps1

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ function parse_json($path) {
77
try {
88
Get-Content $path -Raw -Encoding UTF8 | ConvertFrom-Json -ErrorAction Stop
99
} catch {
10-
warn "Error parsing JSON at $path."
10+
warn "Error parsing JSON at '$path'."
1111
}
1212
}
1313

@@ -27,7 +27,7 @@ function url_manifest($url) {
2727
try {
2828
$str | ConvertFrom-Json -ErrorAction Stop
2929
} catch {
30-
warn "Error parsing JSON at $url."
30+
warn "Error parsing JSON at '$url'."
3131
}
3232
}
3333

@@ -44,24 +44,23 @@ function Get-Manifest($app) {
4444
if ($bucket) {
4545
$manifest = manifest $app $bucket
4646
} else {
47-
foreach ($bucket in Get-LocalBucket) {
48-
$manifest = manifest $app $bucket
47+
foreach ($tekcub in Get-LocalBucket) {
48+
$manifest = manifest $app $tekcub
4949
if ($manifest) {
50+
$bucket = $tekcub
5051
break
5152
}
5253
}
5354
}
5455
if (!$manifest) {
5556
# couldn't find app in buckets: check if it's a local path
56-
$appPath = $app
57-
$bucket = $null
58-
if (!$appPath.EndsWith('.json')) {
59-
$appPath += '.json'
60-
}
61-
if (Test-Path $appPath) {
62-
$url = Convert-Path $appPath
57+
if (Test-Path $app) {
58+
$url = Convert-Path $app
6359
$app = appname_from_url $url
6460
$manifest = url_manifest $url
61+
} else {
62+
if (($app -match '\\/') -or $app.EndsWith('.json')) { $url = $app }
63+
$app = appname_from_url $app
6564
}
6665
}
6766
}

libexec/scoop-cat.ps1

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ if (!$app) { error '<app> missing'; my_usage; exit 1 }
1414
$null, $manifest, $bucket, $url = Get-Manifest $app
1515

1616
if ($manifest) {
17-
$style = get_config CAT_STYLE
18-
if ($style) {
19-
$manifest | ConvertToPrettyJson | bat --no-paging --style $style --language json
20-
} else {
21-
$manifest | ConvertToPrettyJson
22-
}
17+
$style = get_config CAT_STYLE
18+
if ($style) {
19+
$manifest | ConvertToPrettyJson | bat --no-paging --style $style --language json
20+
} else {
21+
$manifest | ConvertToPrettyJson
22+
}
2323
} else {
24-
abort "Couldn't find manifest for '$app'$(if($url) { " at the URL $url" })."
24+
abort "Couldn't find manifest for '$app'$(if($bucket) { " from '$bucket' bucket" } elseif($url) { " at '$url'" })."
2525
}
2626

2727
exit $exitCode

libexec/scoop-download.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ foreach ($curr_app in $apps) {
7070
}
7171

7272
if(!$manifest) {
73-
error "Couldn't find manifest for '$app'$(if($url) { " at the URL $url" })."
73+
error "Couldn't find manifest for '$app'$(if($bucket) { " from '$bucket' bucket" } elseif($url) { " at '$url'" })."
7474
continue
7575
}
7676
$version = $manifest.version

0 commit comments

Comments
 (0)