Files
Scoop/lib/buckets.ps1
T
Roy Ivy III 6d9bca805f whitespace cleanup
* makes changes to almost all main repo files to be in accordance with .editorconfig
* some files in "test\fixtures\..." were left alone to avoid breaking tests
* NOTE: whitespace changes *only* (`git diff -b` shows no changes)
2015-08-17 22:54:43 -05:00

35 lines
825 B
PowerShell

$bucketsdir = "$scoopdir\buckets"
function bucketdir($name) {
if(!$name) { return relpath "..\bucket" } # main bucket
"$bucketsdir\$name"
}
function known_bucket_repo($name) {
$dir = versiondir 'scoop' 'current'
$json = "$dir\buckets.json"
$buckets = gc $json -raw | convertfrom-json -ea stop
$buckets.$name
}
function apps_in_bucket($dir) {
gci $dir | ? { $_.name.endswith('.json') } | % { $_ -replace '.json$', '' }
}
function buckets {
$buckets = @()
if(test-path $bucketsdir) {
gci $bucketsdir | % { $buckets += $_.name }
}
$buckets
}
function find_manifest($app) {
$buckets = @($null) + @(buckets) # null for main bucket
foreach($bucket in $buckets) {
$manifest = manifest $app $bucket
if($manifest) { return $manifest, $bucket }
}
}