mirror of
https://github.com/ScoopInstaller/Scoop.git
synced 2025-12-11 10:35:44 +00:00
fix(database): Update cache when adding bucket (#5946)
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
|
||||
### Features
|
||||
|
||||
- **scoop-search:** Use SQLite for caching apps to speed up local search ([#5851](https://github.com/ScoopInstaller/Scoop/issues/5851), [#5918](https://github.com/ScoopInstaller/Scoop/issues/5918))
|
||||
- **core:** New cache filename format ([#5929](https://github.com/ScoopInstaller/Scoop/issues/5929)
|
||||
- **scoop-search:** Use SQLite for caching apps to speed up local search ([#5851](https://github.com/ScoopInstaller/Scoop/issues/5851), [#5918](https://github.com/ScoopInstaller/Scoop/issues/5918), [#5946](https://github.com/ScoopInstaller/Scoop/issues/5946))
|
||||
- **core:** New cache filename format ([#5929](https://github.com/ScoopInstaller/Scoop/issues/5929))
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
|
||||
@@ -156,6 +156,10 @@ function add_bucket($name, $repo) {
|
||||
$dir = ensure $dir
|
||||
Invoke-Git -ArgumentList @('clone', $repo, $dir, '-q')
|
||||
Write-Host 'OK'
|
||||
if (get_config USE_SQLITE_CACHE) {
|
||||
info 'Updating cache...'
|
||||
Set-ScoopDB -Path (Get-ChildItem -Path $dir -Filter '*.json' -Recurse).FullName
|
||||
}
|
||||
success "The $name bucket was added successfully."
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -202,9 +202,9 @@ function Set-ScoopDB {
|
||||
$bucketPath = Get-LocalBucket | ForEach-Object { Join-Path $bucketsdir $_ }
|
||||
$Path = (Get-ChildItem $bucketPath -Filter '*.json' -Recurse).FullName
|
||||
}
|
||||
$Path | ForEach-Object {
|
||||
$Path | Where-Object { $_ -notmatch '[\\/]\.' } | ForEach-Object {
|
||||
$manifestRaw = [System.IO.File]::ReadAllText($_)
|
||||
$manifest = $manifestRaw | ConvertFrom-Json -ErrorAction Continue
|
||||
$manifest = ConvertFrom-Json $manifestRaw -ErrorAction SilentlyContinue
|
||||
if ($null -ne $manifest.version) {
|
||||
$list.Add([pscustomobject]@{
|
||||
name = $($_ -replace '.*[\\/]([^\\/]+)\.json$', '$1')
|
||||
|
||||
@@ -19,6 +19,11 @@
|
||||
# scoop bucket known
|
||||
param($cmd, $name, $repo)
|
||||
|
||||
if (get_config USE_SQLITE_CACHE) {
|
||||
. "$PSScriptRoot\..\lib\manifest.ps1"
|
||||
. "$PSScriptRoot\..\lib\database.ps1"
|
||||
}
|
||||
|
||||
$usage_add = 'usage: scoop bucket add <name> [<repo>]'
|
||||
$usage_rm = 'usage: scoop bucket rm <name>'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user