Skip to content

Commit

Permalink
Minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Ash258 committed Apr 25, 2020
1 parent 4a3509e commit 1a88e05
Show file tree
Hide file tree
Showing 16 changed files with 56 additions and 82 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
.DS_Store
._.DS_Store
scoop.sublime-workspace
test/installer/tmp/*
test/tmp/*
*~
Expand Down
9 changes: 7 additions & 2 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
{
"recommendations": [
"EditorConfig.EditorConfig",
"ms-vscode.PowerShell"
]
"ms-vscode.PowerShell",
"DavidAnson.vscode-markdownlint",
"CoenraadS.bracket-pair-colorizer-2",
"fabiospampinato.vscode-terminals",
"redhat.vscode-yaml",
"yzhang.markdown-all-in-one",
],
}
12 changes: 0 additions & 12 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,7 @@
// Configure PSScriptAnalyzer settings
{
"[powershell]": {
// Disable formating until: https://github.com/PowerShell/vscode-powershell/issues/1019 is fixed
"editor.formatOnSave": false
},
"powershell.scriptAnalysis.settingsPath": "PSScriptAnalyzerSettings.psd1",
"powershell.codeFormatting.preset": "OTBS",
"powershell.codeFormatting.alignPropertyValuePairs": true,
"powershell.codeFormatting.ignoreOneLineBlock": true,
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true,
"**/tmp": true
}
}
1 change: 1 addition & 0 deletions _wiki/.gitkeep
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Comfort CI
5 changes: 3 additions & 2 deletions bin/auto-pr.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ param(
[Switch] $SkipUpdated
)

. "$PSScriptRoot\..\lib\manifest.ps1"
. "$PSScriptRoot\..\lib\json.ps1"
'manifest', 'json' | ForEach-Object {
. "$PSScriptRoot\..\lib\$_.ps1"
}

$Dir = Resolve-Path $Dir

Expand Down
13 changes: 5 additions & 8 deletions bin/checkhashes.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Check if ALL urls inside manifest have correct hashes.
.PARAMETER App
Manifest to be checked.
Wildcard is supported.
Wildcards are supported.
.PARAMETER Dir
Where to search for manifest(s).
.PARAMETER Update
Expand All @@ -23,6 +23,7 @@
Check MANIFEST and Update if there are some wrong hashes.
#>
param(
[SupportsWildcards()]
[String] $App = '*',
[Parameter(Mandatory = $true)]
[ValidateScript( {
Expand All @@ -40,13 +41,9 @@ param(
[Switch] $UseCache
)

. "$PSScriptRoot\..\lib\core.ps1"
. "$PSScriptRoot\..\lib\manifest.ps1"
. "$PSScriptRoot\..\lib\buckets.ps1"
. "$PSScriptRoot\..\lib\autoupdate.ps1"
. "$PSScriptRoot\..\lib\json.ps1"
. "$PSScriptRoot\..\lib\versions.ps1"
. "$PSScriptRoot\..\lib\install.ps1"
'core', 'manifest', 'buckets', 'autoupdate', 'json', 'versions', 'install' | ForEach-Object {
. "$PSScriptRoot\..\lib\$_.ps1"
}

$Dir = Resolve-Path $Dir
if ($ForceUpdate) { $Update = $true }
Expand Down
9 changes: 5 additions & 4 deletions bin/checkurls.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
List manifests which do not have valid URLs.
.PARAMETER App
Manifest name to search.
Placeholder is supported.
Wildcards is supported.
.PARAMETER Dir
Where to search for manifest(s).
.PARAMETER Timeout
Expand All @@ -12,6 +12,7 @@
Manifests will all valid URLs will not be shown.
#>
param(
[SupportsWildcards()]
[String] $App = '*',
[Parameter(Mandatory = $true)]
[ValidateScript( {
Expand All @@ -26,9 +27,9 @@ param(
[Switch] $SkipValid
)

. "$PSScriptRoot\..\lib\core.ps1"
. "$PSScriptRoot\..\lib\manifest.ps1"
. "$PSScriptRoot\..\lib\install.ps1"
'core', 'manifest', 'install' | ForEach-Object {
. "$PSScriptRoot\..\lib\$_.ps1"
}

$Dir = Resolve-Path $Dir
$Queue = @()
Expand Down
15 changes: 6 additions & 9 deletions bin/checkver.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Checks websites for newer versions using an (optional) regular expression defined in the manifest.
.PARAMETER App
Manifest name to search.
Placeholders are supported.
Wildcards are supported.
.PARAMETER Dir
Where to search for manifest(s).
.PARAMETER Update
Expand Down Expand Up @@ -47,6 +47,7 @@
Check manifest APP.json inside ./DIR directory and update if there is newer version.
#>
param(
[SupportsWildcards()]
[String] $App = '*',
[Parameter(Mandatory = $true)]
[ValidateScript( {
Expand All @@ -63,13 +64,9 @@ param(
[String] $Version = ''
)

. "$psscriptroot\..\lib\core.ps1"
. "$psscriptroot\..\lib\manifest.ps1"
. "$psscriptroot\..\lib\buckets.ps1"
. "$psscriptroot\..\lib\autoupdate.ps1"
. "$psscriptroot\..\lib\json.ps1"
. "$psscriptroot\..\lib\versions.ps1"
. "$psscriptroot\..\lib\install.ps1" # needed for hash generation
'core', 'manifest', 'buckets', 'autoupdate', 'json', 'versions', 'install' | ForEach-Object {
. "$PSScriptRoot\..\lib\$_.ps1"
}

$Dir = Resolve-Path $Dir
$Search = $App
Expand Down Expand Up @@ -258,7 +255,7 @@ while ($in_progress -gt 0) {
}

if ($match -and $match.Success) {
$matchesHashtable = @{}
$matchesHashtable = @{ }
$regex.GetGroupNames() | ForEach-Object { $matchesHashtable.Add($_, $match.Groups[$_].Value) }
$ver = $matchesHashtable['1']
if ($replace) {
Expand Down
11 changes: 6 additions & 5 deletions bin/describe.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
Search for application description on homepage.
.PARAMETER App
Manifest name to search.
Placeholders are supported.
Wildcards are supported.
.PARAMETER Dir
Where to search for manifest(s).
#>
param(
[SupportsWildcards()]
[String] $App = '*',
[Parameter(Mandatory = $true)]
[Parameter(Mandatory)]
[ValidateScript( {
if (!(Test-Path $_ -Type Container)) {
throw "$_ is not a directory!"
Expand All @@ -20,9 +21,9 @@ param(
[String] $Dir
)

. "$PSScriptRoot\..\lib\core.ps1"
. "$PSScriptRoot\..\lib\manifest.ps1"
. "$PSScriptRoot\..\lib\description.ps1"
'core', 'manifest', 'description' | ForEach-Object {
. "$PSScriptRoot\..\lib\$_.ps1"
}

$Dir = Resolve-Path $Dir
$Queue = @()
Expand Down
7 changes: 4 additions & 3 deletions bin/formatjson.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
Format manifest '7zip' inside bucket directory.
#>
param(
[SupportsWildcards()]
[String] $App = '*',
[Parameter(Mandatory = $true)]
[ValidateScript( {
Expand All @@ -27,9 +28,9 @@ param(
[String] $Dir
)

. "$PSScriptRoot\..\lib\core.ps1"
. "$PSScriptRoot\..\lib\manifest.ps1"
. "$PSScriptRoot\..\lib\json.ps1"
'core', 'manifest', 'json' | ForEach-Object {
. "$PSScriptRoot\..\lib\$_.ps1"
}

$Dir = Resolve-Path $Dir

Expand Down
6 changes: 3 additions & 3 deletions bin/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
# remote install:
# Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')
$old_erroractionpreference = $erroractionpreference
$erroractionpreference = 'stop' # quit if anything goes wrong
$ErrorActionPreference = 'Stop' # quit if anything goes wrong

if (($PSVersionTable.PSVersion.Major) -lt 5) {
if ($PSVersionTable.PSVersion.Major -lt 5) {
Write-Output "PowerShell 5 or later is required to run Scoop."
Write-Output "Upgrade PowerShell: https://docs.microsoft.com/en-us/powershell/scripting/setup/installing-windows-powershell"
break
Expand Down Expand Up @@ -76,4 +76,4 @@ success 'Scoop was installed successfully!'

Write-Output "Type 'scoop help' for instructions."

$erroractionpreference = $old_erroractionpreference # Reset $erroractionpreference to original value
$ErrorActionPreference = $old_erroractionpreference # Reset $erroractionpreference to original value
8 changes: 5 additions & 3 deletions bin/missing-checkver.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
Check if manifest contains checkver and autoupdate property.
.PARAMETER App
Manifest name.
Wirldcard is supported.
Wirldcards are supported.
.PARAMETER Dir
Location of manifests.
.PARAMETER SkipSupported
Manifests with checkver and autoupdate will not be presented.
#>
param(
[SupportsWildcards()]
[String] $App = '*',
[Parameter(Mandatory = $true)]
[ValidateScript( {
Expand All @@ -23,8 +24,9 @@ param(
[Switch] $SkipSupported
)

. "$PSScriptRoot\..\lib\core.ps1"
. "$PSScriptRoot\..\lib\manifest.ps1"
'core', 'manifest' | ForEach-Object {
. "$PSscriptRoot\..\lib\$_.ps1"
}

$Dir = Resolve-Path $Dir

Expand Down
19 changes: 0 additions & 19 deletions bin/refresh.ps1

This file was deleted.

12 changes: 7 additions & 5 deletions bin/scoop.ps1
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#requires -v 3
#Requires -Version 5
param($cmd)

set-strictmode -off
Set-StrictMode -off

. "$psscriptroot\..\lib\core.ps1"
. "$psscriptroot\..\lib\git.ps1"
. "$psscriptroot\..\lib\buckets.ps1"
'core', 'git', 'buckets' | ForEach-Object {
. "$PSScriptRoot\..\lib\$_.ps1"
}

# TODO: ???
. (relpath '..\lib\commands')

reset_aliases
Expand Down
2 changes: 1 addition & 1 deletion bin/test.ps1
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invoke-pester "$psscriptroot\..\test"
Invoke-Pester "$PSScriptRoot\..\test"
8 changes: 3 additions & 5 deletions bin/uninstall.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@ param(
[bool] $purge
)

. "$PSScriptRoot\..\lib\core.ps1"
. "$PSScriptRoot\..\lib\install.ps1"
. "$PSScriptRoot\..\lib\shortcuts.ps1"
. "$PSScriptRoot\..\lib\versions.ps1"
. "$PSScriptRoot\..\lib\manifest.ps1"
'core', 'install', 'shortcuts', 'versions', 'manifest' | ForEach-Object {
. "$PSScriptRoot\..\lib\$_.ps1"
}

if ($global -and !(is_admin)) {
error 'You need admin rights to uninstall globally.'
Expand Down

0 comments on commit 1a88e05

Please sign in to comment.