Skip to content

Commit

Permalink
chore: Remove long-time deprecated functions (#117)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ash258 committed Feb 13, 2021
1 parent ac012d0 commit 8982dad
Show file tree
Hide file tree
Showing 12 changed files with 11 additions and 154 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### 0.6-pre2

- Remove deprecated functions from code-base
- **binaries**: Indicate binary execution errors with exit codes
- Git operations with custom wrapper are now executable under Unix-like systems
- **auto-pr**
Expand Down
32 changes: 0 additions & 32 deletions lib/Git.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -76,35 +76,3 @@ function Invoke-GitCmd {
Invoke-SystemComSpecCommand -Windows $commandToRunWindows -Unix $commandToRunNix
}
}

#region Deprecated
function git_proxy_cmd {
Show-DeprecatedWarning $MyInvocation 'Invoke-GitCmd'
Invoke-GitCmd -Command @args -Proxy
}

function git_clone {
Show-DeprecatedWarning $MyInvocation 'Invoke-GitCmd'
Invoke-GitCmd -Command 'Clone' -Argument $args -Proxy
}

function git_ls_remote {
Show-DeprecatedWarning $MyInvocation 'Invoke-GitCmd'
Invoke-GitCmd -Command 'ls-remote' -Argument $args -Proxy
}

function git_pull {
Show-DeprecatedWarning $MyInvocation 'Invoke-GitCmd'
Invoke-GitCmd -Command 'Update' -Argument $args -Proxy
}

function git_fetch {
Show-DeprecatedWarning $MyInvocation 'Invoke-GitCmd'
Invoke-GitCmd -Command 'fetch' -Argument $args -Proxy
}

function git_checkout {
Show-DeprecatedWarning $MyInvocation 'Invoke-GitCmd'
Invoke-GitCmd -Command 'checkout' -Argument $args -Proxy
}
#endregion Deprecated
37 changes: 1 addition & 36 deletions lib/Versions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -214,44 +214,9 @@ function Split-Version {
}

#region Deprecated
function qsort($ary, $fn) {
Write-UserMessage -Message '"qsort" is deprecated. Please avoid using it anymore.' -Warning

if ($null -eq $ary) { return @() }
if (!($ary -is [array])) { return @($ary) }

$pivot = $ary[0]
$rem = $ary[1..($ary.length - 1)]

$lesser = qsort ($rem | Where-Object { (& $fn $pivot $_) -lt 0 }) $fn

$greater = qsort ($rem | Where-Object { (& $fn $pivot $_) -ge 0 }) $fn

return @() + $lesser + @($pivot) + $greater
}

function sort_versions($versions) {
Write-UserMessage -Message '"sort_versions" is deprecated. Please avoid using it anymore.' -Warning
return qsort $versions Compare-Version
}

function compare_versions($a, $b) {
Show-DeprecatedWarning $MyInvocation 'Compare-Version'
return Compare-Version -ReferenceVersion $b -DifferenceVersion $a
}

function latest_version($app, $bucket, $url) {
Show-DeprecatedWarning $MyInvocation 'Get-LatestVersion'
return Get-LatestVersion -AppName $app -Bucket $bucket -Uri $url
}

# This has to stay for mro manifest
function current_version($app, $global) {
Show-DeprecatedWarning $MyInvocation 'Select-CurrentVersion'
return Select-CurrentVersion -AppName $app -Global:$global
}

function versions($app, $global) {
Show-DeprecatedWarning $MyInvocation 'Get-InstalledVersion'
return Get-InstalledVersion -AppName $app -Global:$global
}
#endregion Deprecated
24 changes: 0 additions & 24 deletions lib/buckets.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -150,28 +150,4 @@ function bucketdir($name) {

return Find-BucketDirectory $name
}

function buckets {
Show-DeprecatedWarning $MyInvocation 'Get-LocalBucket'

return Get-LocalBucket
}

function known_buckets {
Show-DeprecatedWarning $MyInvocation 'Get-KnownBucket'

return Get-KnownBucket
}

function rm_bucket($name) {
Show-DeprecatedWarning $MyInvocation 'Remove-Bucket'

Remove-Bucket -Name $name
}

function add_bucket($name, $repo) {
Show-DeprecatedWarning $MyInvocation 'Add-Bucket'

Add-Bucket -Name $name -RepositoryUrl $repo
}
#endregion Deprecated
11 changes: 0 additions & 11 deletions lib/commands.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,3 @@ function Invoke-ScoopCommand {

& (command_path $cmd) @arguments
}

#region Deprecated
function exec($cmd, $arguments) {
# Show-DeprecatedWarning $MyInvocation 'Invoke-ScoopCommand'
# Invoke-ScoopCommand $cmd $arguments

$cmd_path = command_path $cmd

& $cmd_path @arguments
}
#endregion Deprecated
10 changes: 0 additions & 10 deletions lib/core.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1108,16 +1108,6 @@ function run($exe, $arg, $msg, $continue_exit_codes) {
Invoke-ExternalCommand -FilePath $exe -ArgumentList $arg -Activity $msg -ContinueExitCodes $continue_exit_codes
}

function get_magic_bytes($file) {
Show-DeprecatedWarning $MyInvocation 'Get-MagicByte'
return Get-MagicByte -File $file
}

function get_magic_bytes_pretty($file, $glue = ' ') {
Show-DeprecatedWarning $MyInvocation 'Get-MagicByte'
return Get-MagicByte -File $file -Glue $glue -Pretty
}

function fullpath($path) {
Show-DeprecatedWarning $MyInvocation 'Get-AbsolutePath'
return Get-AbsolutePath -Path $path
Expand Down
22 changes: 0 additions & 22 deletions lib/decompress.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -491,25 +491,3 @@ function Expand-ZstdArchive {
if ($Removal) { Remove-Item -Path $Path -Force }
}
}

#region Deprecated
function extract_7zip($path, $to, $removal) {
Show-DeprecatedWarning $MyInvocation 'Expand-7zipArchive'
Expand-7zipArchive -Path $path -DestinationPath $to -Removal:$removal @args
}

function extract_msi($path, $to, $removal) {
Show-DeprecatedWarning $MyInvocation 'Expand-MsiArchive'
Expand-MsiArchive -Path $path -DestinationPath $to -Removal:$removal @args
}

function unpack_inno($path, $to, $removal) {
Show-DeprecatedWarning $MyInvocation 'Expand-InnoArchive'
Expand-InnoArchive -Path $path -DestinationPath $to -Removal:$removal @args
}

function extract_zip($path, $to, $removal) {
Show-DeprecatedWarning $MyInvocation 'Expand-ZipArchive'
Expand-ZipArchive -Path $path -DestinationPath $to -Removal:$removal
}
#endregion Deprecated
6 changes: 3 additions & 3 deletions lib/depends.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ function script_deps($script) {
if ([String]::IsNullOrEmpty($script)) { return $deps }

if (($script -like '*Expand-DarkArchive *') -and !(Test-HelperInstalled -Helper 'Dark')) { $deps += 'dark' }
if ((($script -like '*Expand-7zipArchive *') -or ($script -like '*extract_7zip *')) -and !(Test-HelperInstalled -Helper '7zip')) { $deps += '7zip' }
if ((($script -like '*Expand-MsiArchive *') -or ($script -like '*extract_msi *')) -and !(Test-HelperInstalled -Helper 'Lessmsi')) { $deps += 'lessmsi' }
if ((($script -like '*Expand-InnoArchive *') -or ($script -like '*unpack_inno *')) -and !(Test-HelperInstalled -Helper 'Innounp')) { $deps += 'innounp' }
if (($script -like '*Expand-7zipArchive *') -and !(Test-HelperInstalled -Helper '7zip')) { $deps += '7zip' }
if (($script -like '*Expand-MsiArchive *') -and !(Test-HelperInstalled -Helper 'Lessmsi')) { $deps += 'lessmsi' }
if (($script -like '*Expand-InnoArchive *') -and !(Test-HelperInstalled -Helper 'Innounp')) { $deps += 'innounp' }
if (($script -like '*Expand-ZstdArchive *') -and !(Test-HelperInstaller -Helper 'Zstd')) {
# Ugly, unacceptable and horrible patch to cover the tar.zstd use cases
if (!(Test-HelperInstalled -Helper '7zip')) { $deps += '7zip' }
Expand Down
5 changes: 0 additions & 5 deletions lib/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,6 @@ function install_app($app, $architecture, $global, $suggested, $use_cache = $tru
}
}

function locate($app, $bucket) {
Show-DeprecatedWarning $MyInvocation 'Find-Manifest'
return Find-Manifest $app $bucket
}

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

Expand Down
5 changes: 2 additions & 3 deletions test/Scoop-Manifest.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,8 @@ Describe -Tag 'Manifests' 'manifest-validation' {

Context 'manifest validates against the schema' {
BeforeAll {
if ($null -eq $bucketdir) {
$bucketdir = "$PSScriptRoot\..\bucket\"
}
if ($null -eq $bucketdir) { $bucketdir = "$PSScriptRoot\..\bucket\" }
if (!(Test-Path $bucketdir)) { New-Item $bucketdir -ItemType 'Directory' -Force }
$changed_manifests = @()
if ($env:CI -eq $true) {
$commit = if ($env:APPVEYOR_PULL_REQUEST_HEAD_COMMIT) { $env:APPVEYOR_PULL_REQUEST_HEAD_COMMIT } else { $env:APPVEYOR_REPO_COMMIT }
Expand Down
4 changes: 2 additions & 2 deletions test/fixtures/format/formated/4-script-block.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
"architecture": {
"64bit": {
"installer": {
"script": "extract_7zip \"$dir\\app-64.7z\" \"$dir\""
"script": "Expand-7zipArchive \"$dir\\app-64.7z\" \"$dir\""
}
},
"32bit": {
"installer": {
"script": "extract_7zip \"$dir\\app-32.7z\" \"$dir\""
"script": "Expand-7zipArchive \"$dir\\app-32.7z\" \"$dir\""
}
}
},
Expand Down
8 changes: 2 additions & 6 deletions test/fixtures/format/unformated/4-script-block.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,12 @@
"architecture": {
"64bit": {
"installer": {
"script": [
"extract_7zip \"$dir\\app-64.7z\" \"$dir\""
]
"script": ["Expand-7zipArchive \"$dir\\app-64.7z\" \"$dir\""]
}
},
"32bit": {
"installer": {
"script": [
"extract_7zip \"$dir\\app-32.7z\" \"$dir\""
]
"script": ["Expand-7zipArchive \"$dir\\app-32.7z\" \"$dir\""]
}
}
},
Expand Down

0 comments on commit 8982dad

Please sign in to comment.