feat(sublime pkgs): use local cache of pkgs

- Sublime Package Control can run rampant with
    memory usage when installing 50+ new packages
    all at once, so prime it with a local cache instead
    of expecting everything to install on first startup
 - This also prevents all sorts of Sublime error dialogs
    as package setings are present, but packages may
    not exist yet
This commit is contained in:
Iristyle
2013-04-04 09:41:59 -04:00
parent eadf7a8958
commit 61724d2148
5 changed files with 32 additions and 0 deletions

View File

@@ -24,6 +24,30 @@ function Get-SublimeUserPath
return $path
}
function Install-SublimePackagesFromCache
{
[CmdletBinding()]
param(
[Parameter(Mandatory = $true)]
[string]
$Directory
)
$packagesPath = Get-SublimePackagesPath
Get-ChildItem $Directory |
? { $_.PsIsContainer } |
% { @{Path = $_.FullName; Destination = Join-Path $packagesPath $_.Name }} |
? {
$exists = Test-Path $_.Destination
if ($exists) { Write-Host "[ ] Skipping existing $($_.Destination)" }
return !$exists
} |
% {
Write-Host "[+] Copying cached package $($_.Destination)"
Copy-Item @_ -Recurse
}
}
function Install-SublimePackageControl
{
# install package control