Skip to content

Commit

Permalink
chore(release): Bump to version 0.2.3
Browse files Browse the repository at this point in the history
Merge pull request ScoopInstaller#5031 from ScoopInstaller/develop
  • Loading branch information
rashil2000 authored Jul 7, 2022
2 parents 93db5f4 + b4e0ff1 commit 80b52e3
Show file tree
Hide file tree
Showing 44 changed files with 529 additions and 312 deletions.
29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,32 @@
## [v0.2.3](https://github.com/ScoopInstaller/Scoop/compare/v0.2.2...v0.2.3) - 2022-07-07

### Features

- **chore:** Add missing -a/--all param to all commands ([#5004](https://github.com/ScoopInstaller/Scoop/issues/5004))
- **scoop-status:** Check bucket status, improve output ([#5011](https://github.com/ScoopInstaller/Scoop/issues/5011))
- **scoop-info:** Show app installed/download size ([#4886](https://github.com/ScoopInstaller/Scoop/issues/4886))
- **scoop-import:** Import a Scoop installation from JSON ([#5014](https://github.com/ScoopInstaller/Scoop/issues/5014), [#5034](https://github.com/ScoopInstaller/Scoop/issues/5034))

### Bug Fixes

- **chore:** Update help documentation ([#5002](https://github.com/ScoopInstaller/Scoop/issues/5002), [#5029](https://github.com/ScoopInstaller/Scoop/issues/5029))
- **decompress:** Handle split RAR archives ([#4994](https://github.com/ScoopInstaller/Scoop/issues/4994))
- **shortcuts:** Fix network drive shortcut creation ([#4410](https://github.com/ScoopInstaller/Scoop/issues/4410), [#5006](https://github.com/ScoopInstaller/Scoop/issues/5006))

### Code Refactoring

- **scoop-search:** Output PSObject, use API token ([#4997](https://github.com/ScoopInstaller/Scoop/issues/4997))

### Builds

- **checkver,auto-pr:** Allow passing file path ([#5019](https://github.com/ScoopInstaller/Scoop/issues/5019))
- **checkver:** Exit routine earlier if error ([#5025](https://github.com/ScoopInstaller/Scoop/issues/5025))
- **json:** Update Newton.Json to 13.0.1 ([#5026](https://github.com/ScoopInstaller/Scoop/issues/5026))

### Tests

- **typo:** Fix typo ('formated' -> 'formatted') ([#4217](https://github.com/ScoopInstaller/Scoop/issues/4217))

## [v0.2.2](https://github.com/ScoopInstaller/Scoop/compare/v0.2.1...v0.2.2) - 2022-06-21

### Features
Expand Down
9 changes: 7 additions & 2 deletions bin/auto-pr.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ param(
[String] $Upstream,
[String] $OriginBranch = 'master',
[String] $App = '*',
[Parameter(Mandatory = $true)]
[ValidateScript( {
if (!(Test-Path $_ -Type Container)) {
throw "$_ is not a directory!"
Expand All @@ -64,7 +63,13 @@ param(
. "$PSScriptRoot\..\lib\json.ps1"
. "$PSScriptRoot\..\lib\unix.ps1"

$Dir = Resolve-Path $Dir
if ($App -ne '*' -and (Test-Path $App -PathType Leaf)) {
$Dir = Split-Path $App
} elseif ($Dir) {
$Dir = Resolve-Path $Dir
} else {
throw "'-Dir' parameter required if '-App' is not a filepath!"
}

if ((!$Push -and !$Request) -or $Help) {
Write-Host @'
Expand Down
36 changes: 21 additions & 15 deletions bin/checkver.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
#>
param(
[String] $App = '*',
[Parameter(Mandatory = $true)]
[ValidateScript( {
if (!(Test-Path $_ -Type Container)) {
throw "$_ is not a directory!"
Expand All @@ -77,8 +76,16 @@ param(
. "$PSScriptRoot\..\lib\install.ps1" # needed for hash generation
. "$PSScriptRoot\..\lib\unix.ps1"

$Dir = Resolve-Path $Dir
$Search = $App
if ($App -ne '*' -and (Test-Path $App -PathType Leaf)) {
$Dir = Split-Path $App
$files = Get-ChildItem $Dir (Split-Path $App -Leaf)
} elseif ($Dir) {
$Dir = Resolve-Path $Dir
$files = Get-ChildItem $Dir "$App.json"
} else {
throw "'-Dir' parameter required if '-App' is not a filepath!"
}

$GitHubToken = Get-GitHubToken

# don't use $Version with $App = '*'
Expand All @@ -89,17 +96,16 @@ if ($App -eq '*' -and $Version -ne '') {
# get apps to check
$Queue = @()
$json = ''
Get-ChildItem $Dir "$App.json" | ForEach-Object {
$files | ForEach-Object {
$json = parse_json "$Dir\$($_.Name)"
if ($json.checkver) {
$Queue += , @($_.Name, $json)
}
}

# clear any existing events
Get-Event | ForEach-Object {
Remove-Event $_.SourceIdentifier
}
Get-Event | Remove-Event
Get-EventSubscriber | Unregister-Event

# start all downloads
$Queue | ForEach-Object {
Expand Down Expand Up @@ -218,20 +224,20 @@ while ($in_progress -gt 0) {
$ver = $Version

if (!$ver) {
$page = (Get-Encoding($wc)).GetString($ev.SourceEventArgs.Result)
$err = $ev.SourceEventArgs.Error
if ($json.checkver.script) {
$page = Invoke-Command ([scriptblock]::Create($json.checkver.script -join "`r`n"))
if (!$regex -and $replace) {
next "'replace' requires 're' or 'regex'"
continue
}

$err = $ev.SourceEventArgs.Error
if ($err) {
next "$($err.message)`r`nURL $url is not valid"
continue
}

if (!$regex -and $replace) {
next "'replace' requires 're' or 'regex'"
continue
if ($json.checkver.script) {
$page = Invoke-Command ([scriptblock]::Create($json.checkver.script -join "`r`n"))
} else {
$page = (Get-Encoding($wc)).GetString($ev.SourceEventArgs.Result)
}

if ($jsonpath) {
Expand Down
2 changes: 1 addition & 1 deletion bin/scoop.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ switch ($subCommand) {
}
}
default {
"scoop: '$subCommand' isn't a scoop command. See 'scoop help'."
warn "scoop: '$subCommand' isn't a scoop command. See 'scoop help'."
exit 1
}
}
2 changes: 1 addition & 1 deletion lib/buckets.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ function add_bucket($name, $repo) {

$dir = Find-BucketDirectory $name -Root
if (Test-Path $dir) {
warn "The '$name' bucket already exists. Use 'scoop bucket rm $name' to remove it."
warn "The '$name' bucket already exists. To add this bucket again, first remove it by running 'scoop bucket rm $name'."
return 2
}

Expand Down
3 changes: 3 additions & 0 deletions lib/decompress.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ function Expand-7zipArchive {
if (($Path -replace '.*\.([^\.]*)$', '$1') -eq '001') {
# Remove splited 7-zip archive parts
Get-ChildItem "$($Path -replace '\.[^\.]*$', '').???" | Remove-Item -Force
} elseif (($Path -replace '.*\.part(\d+)\.rar$', '$1')[-1] -eq '1') {
# Remove splitted RAR archive parts
Get-ChildItem "$($Path -replace '\.part(\d+)\.rar$', '').part*.rar" | Remove-Item -Force
} else {
Remove-Item $Path -Force
}
Expand Down
14 changes: 11 additions & 3 deletions lib/manifest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@ function manifest_path($app, $bucket) {
}

function parse_json($path) {
if(!(test-path $path)) { return $null }
Get-Content $path -raw -Encoding UTF8 | convertfrom-json -ea stop
if (!(Test-Path $path)) { return $null }
try {
Get-Content $path -Raw -Encoding UTF8 | ConvertFrom-Json -ErrorAction Stop
} catch {
warn "Error parsing JSON at $path."
}
}

function url_manifest($url) {
Expand All @@ -20,7 +24,11 @@ function url_manifest($url) {
throw
}
if(!$str) { return $null }
$str | convertfrom-json
try {
$str | ConvertFrom-Json -ErrorAction Stop
} catch {
warn "Error parsing JSON at $url."
}
}

function Get-Manifest($app) {
Expand Down
22 changes: 5 additions & 17 deletions lib/shortcuts.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ function create_startmenu_shortcuts($manifest, $dir, $global, $arch) {
}

function shortcut_folder($global) {
$directory = [System.IO.Path]::Combine([Environment]::GetFolderPath('startmenu'), 'Programs', 'Scoop Apps')
if($global) {
$directory = [System.IO.Path]::Combine([Environment]::GetFolderPath('commonstartmenu'), 'Programs', 'Scoop Apps')
if ($global) {
$startmenu = 'CommonStartMenu'
} else {
$startmenu = 'StartMenu'
}
return $(ensure $directory)
return Convert-Path (ensure ([System.IO.Path]::Combine([Environment]::GetFolderPath($startmenu), 'Programs', 'Scoop Apps')))
}

function startmenu_shortcut([System.IO.FileInfo] $target, $shortcutName, $arguments, [System.IO.FileInfo]$icon, $global) {
Expand Down Expand Up @@ -67,18 +68,5 @@ function rm_startmenu_shortcuts($manifest, $global, $arch) {
if(Test-Path -Path $shortcut) {
Remove-Item $shortcut
}
# Before issue 1514 Startmenu shortcut removal
#
# Shortcuts that should have been installed globally would
# have been installed locally up until 27 June 2017.
#
# TODO: Remove this 'if' block and comment after
# 27 June 2018.
if($global) {
$shortcut = "$(shortcut_folder $false)\$name.lnk"
if(Test-Path -Path $shortcut) {
Remove-Item $shortcut
}
}
}
}
8 changes: 4 additions & 4 deletions libexec/scoop-alias.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ function add_alias($name, $command) {
# generate script
$shimdir = shimdir $false
$script =
@"
# Summary: $description
$command
"@
@(
"# Summary: $description",
"$command"
) -join "`r`n"
$script | Out-UTF8File "$shimdir\$alias_file.ps1"

# add alias to config
Expand Down
4 changes: 3 additions & 1 deletion libexec/scoop-cache.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#
# To clear everything in your cache, use:
# scoop cache rm *
# You can also use the `-a/--all` switch in place of `*` here

param($cmd)

function cacheinfo($file) {
Expand All @@ -36,7 +38,7 @@ function cacheremove($app) {
'ERROR: <app(s)> missing'
my_usage
exit 1
} elseif ($app -eq '*') {
} elseif ($app -eq '*' -or $app -eq '-a' -or $app -eq '--all') {
$files = @(Get-ChildItem $cachedir)
} else {
$app = '(' + ($app -join '|') + ')'
Expand Down
11 changes: 7 additions & 4 deletions libexec/scoop-depends.ps1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Usage: scoop depends <app>
# Summary: List dependencies for an app
# Summary: List dependencies for an app, in the order they'll be installed

. "$PSScriptRoot\..\lib\getopt.ps1"
. "$PSScriptRoot\..\lib\depends.ps1" # 'Get-Dependency'
Expand All @@ -17,9 +17,12 @@ try {
abort "ERROR: $_"
}

$deps = @(Get-Dependency $app $architecture) -ne $app
if($deps) {
$deps[($deps.length - 1)..0]
$deps = @()
Get-Dependency $app $architecture | ForEach-Object {
$dep = [ordered]@{}
$dep.Source, $dep.Name = $_ -split '/'
$deps += [PSCustomObject]$dep
}
$deps

exit 0
4 changes: 4 additions & 0 deletions libexec/scoop-download.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
# Help: e.g. The usual way to download an app, without installing it (uses your local 'buckets'):
# scoop download git
#
# To download a different version of the app
# (note that this will auto-generate the manifest using current version):
# scoop download gh@2.7.0
#
# To download an app from a manifest at a URL:
# scoop download https://raw.githubusercontent.com/ScoopInstaller/Main/master/bucket/runat.json
#
Expand Down
64 changes: 15 additions & 49 deletions libexec/scoop-export.ps1
Original file line number Diff line number Diff line change
@@ -1,57 +1,23 @@
# Usage: scoop export > filename
# Summary: Exports (an importable) list of installed apps
# Help: Lists all installed apps.
# Usage: scoop export > scoopfile.json
# Summary: Exports installed apps, buckets (and optionally configs) in JSON format
# Help: Options:
# -c, --config Export the Scoop configuration file too

. "$PSScriptRoot\..\lib\versions.ps1" # 'Select-CurrentVersion'
. "$PSScriptRoot\..\lib\manifest.ps1" # 'default_architecture' 'Select-CurrentVersion' (indirectly)
. "$PSScriptRoot\..\lib\json.ps1" # 'ConvertToPrettyJson'

$def_arch = default_architecture
$export = @{}

$local = installed_apps $false | ForEach-Object { @{ name = $_; global = $false } }
$global = installed_apps $true | ForEach-Object { @{ name = $_; global = $true } }

$apps = @($local) + @($global)
$count = 0

# json
# echo "{["

if($apps) {
$apps | Sort-Object { $_.name } | Where-Object { !$query -or ($_.name -match $query) } | ForEach-Object {
$app = $_.name
$global = $_.global
$ver = Select-CurrentVersion -AppName $app -Global:$global
$global_display = $null; if($global) { $global_display = ' *global*'}

$install_info = install_info $app $ver $global
$bucket = ''
if ($install_info.bucket) {
$bucket = ' [' + $install_info.bucket + ']'
} elseif ($install_info.url) {
$bucket = ' [' + $install_info.url + ']'
}
if ($install_info.architecture -and $def_arch -ne $install_info.architecture) {
$arch = ' {' + $install_info.architecture + '}'
} else {
$arch = ''
}

# json
# $val = "{ 'name': '$app', 'version': '$ver', 'global': $($global.toString().tolower()) }"
# if($count -gt 0) {
# " ," + $val
# } else {
# " " + $val
# }

# "$app (v:$ver) global:$($global.toString().tolower())"
"$app (v:$ver)$global_display$bucket$arch"

$count++
if ($args[0] -eq '-c' -or $args[0] -eq '--config') {
$export.config = $scoopConfig
# Remove machine-specific properties
foreach ($prop in 'lastUpdate', 'rootPath', 'globalPath', 'cachePath', 'alias') {
$export.config.PSObject.Properties.Remove($prop)
}
}

# json
# echo "]}"
$export.buckets = list_buckets
$export.apps = @(& "$PSScriptRoot\scoop-list.ps1" 6>$null)

$export | ConvertToPrettyJSON

exit 0
Loading

0 comments on commit 80b52e3

Please sign in to comment.