Moved logic to szcoop repo

This commit is contained in:
Gal Szkolnik 2021-02-07 14:01:56 -05:00
parent 1672c384ad
commit 53226f09b4
1 changed files with 4 additions and 18 deletions

View File

@ -1,20 +1,6 @@
$local:whenLast = $null
$local:whenLastSavePath = $(Join-Path $env:SCOOP last-scoop-refresh.clixml)
if( Test-Path $whenLastSavePath ) {
$whenLast = Import-Clixml -LiteralPath $whenLastSavePath
}
if( $whenLast ) {
$local:TimePassed = (Get-Date) - $local:whenLast
if( $TimePassed.TotalHours -ge 3 ) {
$whenLast = $null
} else {
Write-Host -ForegroundColor Yellow "Only $(ConvertFrom-TimeSpan $TimePassed) has passed, skipping scoop refresh."
}
}
if( -not $whenLast ) {
if( Test-Path (Join-Path $env:SCOOP last-scoop-refresh.clixml) ) {
scoop refresh
$whenLast | Export-Clixml -LiteralPath $whenLastSavePath
} else {
Write-Warning ("No recorded time for last 'scoop refresh', to remedy, run 'scoop refresh' at least once manually." +
"`nIf the issue still persists, please run 'scoop alias-update' to update to latest refresh code, and try again.")
}