Skip to content

Commit

Permalink
chore(release): Bump to version 0.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
niheaven committed Jun 10, 2022
2 parents 7e6be8f + ecb8f02 commit d63b7d6
Show file tree
Hide file tree
Showing 31 changed files with 341 additions and 258 deletions.
33 changes: 33 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,36 @@
## [v0.2.1](https://github.com/ScoopInstaller/Scoop/compare/v0.2.0...v0.2.1) - 2022-06-10

### Features

- **core:** Add pre_uninstall and post_uninstall hooks ([#4957](https://github.com/ScoopInstaller/Scoop/issues/4957), [#4962](https://github.com/ScoopInstaller/Scoop/issues/4962))

### Bug Fixes

- **bucket:** Make sure `list_buckets` return array ([#4979](https://github.com/ScoopInstaller/Scoop/issues/4979))
- **chore:** Deprecate tls1 and tls1.1 ([#4950](https://github.com/ScoopInstaller/Scoop/issues/4950))
- **chore:** Update Nonportable bucket URL ([#4955](https://github.com/ScoopInstaller/Scoop/issues/4955))
- **core:** Using `Invoke-Command` instead of `Invoke-Expression` ([#4941](https://github.com/ScoopInstaller/Scoop/issues/4941))
- **core:** Load config file before initialization ([#4932](https://github.com/ScoopInstaller/Scoop/issues/4932))
- **core:** Allow to use '_' and '.' in bucket name ([#4952](https://github.com/ScoopInstaller/Scoop/issues/4952))
- **depends:** Avoid digits in archive file extension (except for .7z and .001) ([#4915](https://github.com/ScoopInstaller/Scoop/issues/4915))
- **bucket:** Don't check remote URL of non-git buckets ([#4923](https://github.com/ScoopInstaller/Scoop/issues/4923))
- **bucket:** Don't write message OK before bucket is cloned ([#4925](https://github.com/ScoopInstaller/Scoop/issues/4925))
- **shim:** Add 'Get-CommandPath()' to find git ([#4913](https://github.com/ScoopInstaller/Scoop/issues/4913))
- **shim:** Remove character replacement in .cmd -> .ps1 shims ([#4914](https://github.com/ScoopInstaller/Scoop/issues/4914))
- **scoop:** Pass CLI arguments as string objects ([#4931](https://github.com/ScoopInstaller/Scoop/issues/4931))
- **scoop-info:** Fix error message when manifest is not found ([#4935](https://github.com/ScoopInstaller/Scoop/issues/4935))
- **scoop-search:** Require files in 'bucket' dir for remote known buckets ([#4944](https://github.com/ScoopInstaller/Scoop/issues/4944))
- **update:** Prevent uninstall when update ([#4949](https://github.com/ScoopInstaller/Scoop/issues/4949))
- **scoop-download:** Use correct Args when calling `Get-Manifest` ([#4970](https://github.com/ScoopInstaller/Scoop/issues/4970))

### Code Refactoring

- **manifest:** Rename 'Find-Manifest()' to 'Get-Manifest() ([#4966](https://github.com/ScoopInstaller/Scoop/issues/4966), [#4981](https://github.com/ScoopInstaller/Scoop/issues/4981))

### Documentation

- **readme:** Update license badge ([#4929](https://github.com/ScoopInstaller/Scoop/issues/4929))

## [v0.2.0](https://github.com/ScoopInstaller/Scoop/compare/v0.1.0...v0.2.0) - 2022-05-10

### Features
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
<a href="https://gitter.im/lukesampson/scoop">
<img src="https://badges.gitter.im/lukesampson/scoop.png" alt="Gitter Chat" />
</a>
<a href="https://github.com/ScoopInstaller/Scoop/blob/master/LICENSE">
<img src="https://img.shields.io/github/license/ScoopInstaller/Scoop.svg" alt="License" />
<a href="./LICENSE">
<img src="https://img.shields.io/badge/license-UNLICENSE%20or%20MIT-blue" alt="License" />
</a>
</p>

Expand Down Expand Up @@ -121,7 +121,7 @@ The following buckets are known to scoop:
- [nerd-fonts](https://github.com/matthewjberger/scoop-nerd-fonts) - Nerd Fonts
- [nirsoft](https://github.com/kodybrown/scoop-nirsoft) - Almost all of the [250+](https://rasa.github.io/scoop-directory/by-apps#kodybrown_scoop-nirsoft) apps from [Nirsoft](https://nirsoft.net)
- [java](https://github.com/ScoopInstaller/Java) - A collection of Java development kits (JDKs), Java runtime engines (JREs), Java's virtual machine debugging tools and Java based runtime engines.
- [nonportable](https://github.com/TheRandomLabs/scoop-nonportable) - Non-portable apps (may require UAC)
- [nonportable](https://github.com/ScoopInstaller/Nonportable) - Non-portable apps (may require UAC)
- [php](https://github.com/ScoopInstaller/PHP) - Installers for most versions of PHP
- [versions](https://github.com/ScoopInstaller/Versions) - Alternative versions of apps found in other buckets

Expand Down
2 changes: 1 addition & 1 deletion bin/auto-pr.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ if (is_unix) {

function execute($cmd) {
Write-Host $cmd -ForegroundColor Green
$output = Invoke-Expression $cmd
$output = Invoke-Command ([scriptblock]::Create($cmd))

if ($LASTEXITCODE -gt 0) {
abort "^^^ Error! See above ^^^ (last command: $cmd)"
Expand Down
2 changes: 1 addition & 1 deletion bin/checkver.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ while ($in_progress -gt 0) {
$page = $ev.SourceEventArgs.Result
$err = $ev.SourceEventArgs.Error
if ($json.checkver.script) {
$page = $json.checkver.script -join "`r`n" | Invoke-Expression
$page = Invoke-Command ([scriptblock]::Create($json.checkver.script -join "`r`n"))
}

if ($err) {
Expand Down
33 changes: 15 additions & 18 deletions bin/scoop.ps1
Original file line number Diff line number Diff line change
@@ -1,31 +1,27 @@
#Requires -Version 5
param($SubCommand)

Set-StrictMode -Off

. "$PSScriptRoot\..\lib\core.ps1"
. "$PSScriptRoot\..\lib\buckets.ps1"
. "$PSScriptRoot\..\lib\commands.ps1"
. "$PSScriptRoot\..\lib\help.ps1"

$subCommand = $Args[0]

# for aliases where there's a local function, re-alias so the function takes precedence
$aliases = Get-Alias | Where-Object { $_.Options -notmatch 'ReadOnly|AllScope' } | ForEach-Object { $_.Name }
Get-ChildItem Function: | Where-Object -Property Name -In -Value $aliases | ForEach-Object {
Set-Alias -Name $_.Name -Value Local:$($_.Name) -Scope Script
}

switch ($SubCommand) {
({ $SubCommand -in @($null, '--help', '/?') }) {
if (!$SubCommand -and $Args -eq '-v') {
$SubCommand = '--version'
} else {
exec 'help'
}
switch ($subCommand) {
({ $subCommand -in @($null, '-h', '--help', '/?') }) {
exec 'help'
}
({ $SubCommand -eq '--version' }) {
({ $subCommand -in @('-v', '--version') }) {
Write-Host 'Current Scoop version:'
if ((Test-CommandAvailable git) -and (Test-Path "$PSScriptRoot\..\.git") -and (get_config SCOOP_BRANCH 'master') -ne 'master') {
Invoke-Expression "git -C '$PSScriptRoot\..' --no-pager log --oneline HEAD -n 1"
git -C "$PSScriptRoot\.." --no-pager log --oneline HEAD -n 1
} else {
$version = Select-String -Pattern '^## \[(v[\d.]+)\].*?([\d-]+)$' -Path "$PSScriptRoot\..\CHANGELOG.md"
Write-Host $version.Matches.Groups[1].Value -ForegroundColor Cyan -NoNewline
Expand All @@ -35,22 +31,23 @@ switch ($SubCommand) {

Get-LocalBucket | ForEach-Object {
$bucketLoc = Find-BucketDirectory $_ -Root
if ((Test-Path (Join-Path $bucketLoc '.git')) -and (Test-CommandAvailable git)) {
if ((Test-Path "$bucketLoc\.git") -and (Test-CommandAvailable git)) {
Write-Host "'$_' bucket:"
Invoke-Expression "git -C '$bucketLoc' --no-pager log --oneline HEAD -n 1"
git -C "$bucketLoc" --no-pager log --oneline HEAD -n 1
Write-Host ''
}
}
}
({ $SubCommand -in (commands) }) {
if ($Args -in @('-h', '--help', '/?')) {
exec 'help' @($SubCommand)
({ $subCommand -in (commands) }) {
[string[]]$arguments = $Args | Select-Object -Skip 1
if ($null -ne $arguments -and $arguments[0] -in @('-h', '--help', '/?')) {
exec 'help' @($subCommand)
} else {
exec $SubCommand $Args
exec $subCommand $arguments
}
}
default {
"scoop: '$SubCommand' isn't a scoop command. See 'scoop help'."
"scoop: '$subCommand' isn't a scoop command. See 'scoop help'."
exit 1
}
}
2 changes: 1 addition & 1 deletion buckets.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"nirsoft": "https://github.com/kodybrown/scoop-nirsoft",
"php": "https://github.com/ScoopInstaller/PHP",
"nerd-fonts": "https://github.com/matthewjberger/scoop-nerd-fonts",
"nonportable": "https://github.com/TheRandomLabs/scoop-nonportable",
"nonportable": "https://github.com/ScoopInstaller/Nonportable",
"java": "https://github.com/ScoopInstaller/Java",
"games": "https://github.com/Calinou/scoop-games"
}
53 changes: 11 additions & 42 deletions lib/buckets.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -72,43 +72,11 @@ function buckets {
return Get-LocalBucket
}

function Find-Manifest($app, $bucket) {
$manifest, $url = $null, $null

# check if app is a URL or UNC path
if ($app -match '^(ht|f)tps?://|\\\\') {
$url = $app
$app = appname_from_url $url
$manifest = url_manifest $url
} else {
if ($bucket) {
$manifest = manifest $app $bucket
} else {
foreach ($bucket in Get-LocalBucket) {
$manifest = manifest $app $bucket
if ($manifest) { break }
}
}

if (!$manifest) {
# couldn't find app in buckets: check if it's a local path
$path = $app
if (!$path.endswith('.json')) { $path += '.json' }
if (Test-Path $path) {
$url = "$(Resolve-Path $path)"
$app = appname_from_url $url
$manifest, $bucket = url_manifest $url
}
}
}

return $app, $manifest, $bucket, $url
}

function Convert-RepositoryUri {
[CmdletBinding()]
param (
[Parameter(Mandatory, Position = 0, ValueFromPipeline = $true)]
[AllowEmptyString()]
[String] $Uri
)

Expand Down Expand Up @@ -141,7 +109,7 @@ function list_buckets {
Measure-Object | Select-Object -ExpandProperty Count
$buckets += [PSCustomObject]$bucket
}
$buckets
,$buckets
}

function add_bucket($name, $repo) {
Expand All @@ -161,10 +129,12 @@ function add_bucket($name, $repo) {
return 1
}
foreach ($bucket in Get-LocalBucket) {
$remote = git -C "$bucketsdir\$bucket" config --get remote.origin.url
if ((Convert-RepositoryUri -Uri $remote) -eq $uni_repo) {
warn "Bucket $bucket already exists for $repo"
return 2
if (Test-Path -Path "$bucketsdir\$bucket\.git") {
$remote = git -C "$bucketsdir\$bucket" config --get remote.origin.url
if ((Convert-RepositoryUri -Uri $remote) -eq $uni_repo) {
warn "Bucket $bucket already exists for $repo"
return 2
}
}
}

Expand All @@ -174,11 +144,10 @@ function add_bucket($name, $repo) {
error "'$repo' doesn't look like a valid git repository`n`nError given:`n$out"
return 1
}
Write-Host 'OK'

ensure $bucketsdir | Out-Null
$dir = ensure $dir
git_cmd clone "$repo" "`"$dir`"" -q
Write-Host 'OK'
success "The $name bucket was added successfully."
return 0
}
Expand All @@ -195,12 +164,12 @@ function rm_bucket($name) {
}

function new_issue_msg($app, $bucket, $title, $body) {
$app, $manifest, $bucket, $url = Find-Manifest $app $bucket
$app, $manifest, $bucket, $url = Get-Manifest "$bucket/$app"
$url = known_bucket_repo $bucket
$bucket_path = "$bucketsdir\$bucket"

if (Test-Path $bucket_path) {
$remote = Invoke-Expression "git -C '$bucket_path' config --get remote.origin.url"
$remote = git -C "$bucket_path" config --get remote.origin.url
# Support ssh and http syntax
# git@PROVIDER:USER/REPO.git
# https://PROVIDER/USER/REPO.git
Expand Down
2 changes: 1 addition & 1 deletion lib/commands.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function command_path($cmd) {
$shim_path = "$scoopdir\shims\scoop-$cmd.ps1"
$line = ((Get-Content $shim_path) | Where-Object { $_.startswith('$path') })
if($line) {
Invoke-Expression -command "$line"
Invoke-Command ([scriptblock]::Create($line)) -NoNewScope
$cmd_path = $path
}
else { $cmd_path = $shim_path }
Expand Down

0 comments on commit d63b7d6

Please sign in to comment.