mirror of
https://github.com/ScoopInstaller/Scoop.git
synced 2025-10-30 06:07:56 +00:00
first step
This commit is contained in:
14
lib/core.ps1
14
lib/core.ps1
@@ -1140,7 +1140,19 @@ function applist($apps, $global) {
|
||||
|
||||
function parse_app([string]$app) {
|
||||
if ($app -match '^(?:(?<bucket>[a-zA-Z0-9-_.]+)/)?(?<app>.*\.json|[a-zA-Z0-9-_.]+)(?:@(?<version>.*))?$') {
|
||||
return $Matches['app'], $Matches['bucket'], $Matches['version']
|
||||
$app = $Matches['app']
|
||||
$bucket = $Matches['bucket']
|
||||
$version = $Matches['version']
|
||||
if (installed $app) {
|
||||
$global = installed $app $true
|
||||
$ver = Select-CurrentVersion -AppName $app -Global:$global
|
||||
$install_info_path = "$(versiondir $app $ver $global)\install.json"
|
||||
if (Test-Path $install_info_path) {
|
||||
$install_info = parse_json $install_info_path
|
||||
$bucket = $install_info.bucket
|
||||
}
|
||||
}
|
||||
return $app, $bucket, $version
|
||||
} else {
|
||||
return $app, $null, $null
|
||||
}
|
||||
|
||||
@@ -53,6 +53,16 @@ function Get-Manifest($app) {
|
||||
}
|
||||
}
|
||||
if (!$manifest) {
|
||||
if (installed $app) {
|
||||
$global = installed $app $true
|
||||
$ver = Select-CurrentVersion -AppName $app -Global:$global
|
||||
$install_info_path = "$(versiondir $app $ver $global)\install.json"
|
||||
if (Test-Path $install_info_path) {
|
||||
$install_info = parse_json $install_info_path
|
||||
$url = $install_info.url
|
||||
}
|
||||
$manifest = if (Test-Path $url) { parse_json $url } else { installed_manifest $app $ver $global }
|
||||
}
|
||||
# couldn't find app in buckets: check if it's a local path
|
||||
if (Test-Path $app) {
|
||||
$url = Convert-Path $app
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
param($app)
|
||||
|
||||
. "$PSScriptRoot\..\lib\json.ps1" # 'ConvertToPrettyJson'
|
||||
. "$PSScriptRoot\..\lib\versions.ps1" # 'Select-CurrentVersion'
|
||||
. "$PSScriptRoot\..\lib\manifest.ps1" # 'Get-Manifest'
|
||||
|
||||
if (!$app) { error '<app> missing'; my_usage; exit 1 }
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
. "$PSScriptRoot\..\lib\getopt.ps1"
|
||||
. "$PSScriptRoot\..\lib\json.ps1" # 'autoupdate.ps1' (indirectly)
|
||||
. "$PSScriptRoot\..\lib\autoupdate.ps1" # 'generate_user_manifest' (indirectly)
|
||||
. "$PSScriptRoot\..\lib\versions.ps1" # 'Select-CurrentVersion'
|
||||
. "$PSScriptRoot\..\lib\manifest.ps1" # 'generate_user_manifest' 'Get-Manifest'
|
||||
. "$PSScriptRoot\..\lib\download.ps1"
|
||||
if (get_config USE_SQLITE_CACHE) {
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
# Summary: Opens the app homepage
|
||||
param($app)
|
||||
|
||||
. "$PSScriptRoot\..\lib\versions.ps1" # 'Select-CurrentVersion'
|
||||
. "$PSScriptRoot\..\lib\manifest.ps1" # 'Get-Manifest'
|
||||
|
||||
if ($app) {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
. "$PSScriptRoot\..\lib\getopt.ps1"
|
||||
. "$PSScriptRoot\..\lib\manifest.ps1" # 'Get-Manifest'
|
||||
. "$PSScriptRoot\..\lib\versions.ps1" # 'Get-InstalledVersion'
|
||||
. "$PSScriptRoot\..\lib\versions.ps1" # 'Get-InstalledVersion', 'Select-CurrentVersion'
|
||||
. "$PSScriptRoot\..\lib\download.ps1" # 'Get-RemoteFileSize'
|
||||
|
||||
$opt, $app, $err = getopt $args 'v' 'verbose'
|
||||
@@ -23,7 +23,7 @@ if (!$manifest) {
|
||||
$global = installed $app $true
|
||||
$status = app_status $app $global
|
||||
$install = install_info $app $status.version $global
|
||||
$status.installed = $bucket -and $install.bucket -eq $bucket
|
||||
$status.installed = installed $app
|
||||
$version_output = $manifest.version
|
||||
$manifest_file = if ($bucket) {
|
||||
manifest_path $app $bucket
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
# -p, --passthru Return reports as objects
|
||||
|
||||
. "$PSScriptRoot\..\lib\getopt.ps1"
|
||||
. "$PSScriptRoot\..\lib\versions.ps1" # 'Select-CurrentVersion'
|
||||
. "$PSScriptRoot\..\lib\manifest.ps1" # 'Get-Manifest'
|
||||
. "$PSScriptRoot\..\lib\json.ps1" # 'json_path'
|
||||
. "$PSScriptRoot\..\lib\download.ps1" # 'hash_for_url'
|
||||
|
||||
Reference in New Issue
Block a user