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:
@@ -27,6 +27,8 @@ try {
|
|||||||
Copy-Item @params
|
Copy-Item @params
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$packageCache = Join-Path (Get-CurrentDirectory) 'PackageCache'
|
||||||
|
Install-SublimePackagesFromCache -Directory $packageCache
|
||||||
Install-SublimePackageControl
|
Install-SublimePackageControl
|
||||||
$packageControl = Join-Path $current 'Package Control.sublime-settings'
|
$packageControl = Join-Path $current 'Package Control.sublime-settings'
|
||||||
Merge-PackageControlSettings -FilePath $packageControl
|
Merge-PackageControlSettings -FilePath $packageControl
|
||||||
|
@@ -27,6 +27,8 @@ try {
|
|||||||
Copy-Item @params
|
Copy-Item @params
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$packageCache = Join-Path (Get-CurrentDirectory) 'PackageCache'
|
||||||
|
Install-SublimePackagesFromCache -Directory $packageCache
|
||||||
Install-SublimePackageControl
|
Install-SublimePackageControl
|
||||||
$packageControl = Join-Path $current 'Package Control.sublime-settings'
|
$packageControl = Join-Path $current 'Package Control.sublime-settings'
|
||||||
Merge-PackageControlSettings -FilePath $packageControl
|
Merge-PackageControlSettings -FilePath $packageControl
|
||||||
|
@@ -30,6 +30,8 @@ try {
|
|||||||
([IO.File]::ReadAllText($sublimeFiles)) -replace '{{term_command}}', $escapedPs |
|
([IO.File]::ReadAllText($sublimeFiles)) -replace '{{term_command}}', $escapedPs |
|
||||||
Out-File -FilePath (Join-Path $sublimeUserDataPath $sublimeFilesFileName) -Force -Encoding ASCII
|
Out-File -FilePath (Join-Path $sublimeUserDataPath $sublimeFilesFileName) -Force -Encoding ASCII
|
||||||
|
|
||||||
|
$packageCache = Join-Path (Get-CurrentDirectory) 'PackageCache'
|
||||||
|
Install-SublimePackagesFromCache -Directory $packageCache
|
||||||
Install-SublimePackageControl
|
Install-SublimePackageControl
|
||||||
$packageControl = (Join-Path (Get-CurrentDirectory) 'Package Control.sublime-settings')
|
$packageControl = (Join-Path (Get-CurrentDirectory) 'Package Control.sublime-settings')
|
||||||
Merge-PackageControlSettings -FilePath $packageControl
|
Merge-PackageControlSettings -FilePath $packageControl
|
||||||
|
@@ -49,6 +49,8 @@ try {
|
|||||||
([IO.File]::ReadAllText($grunt)) -replace '{{node_path}}', $escapedNodeRoot |
|
([IO.File]::ReadAllText($grunt)) -replace '{{node_path}}', $escapedNodeRoot |
|
||||||
Out-File -FilePath (Join-Path $sublimeUserDataPath $gruntFileName) -Force -Encoding ASCII
|
Out-File -FilePath (Join-Path $sublimeUserDataPath $gruntFileName) -Force -Encoding ASCII
|
||||||
|
|
||||||
|
$packageCache = Join-Path (Get-CurrentDirectory) 'PackageCache'
|
||||||
|
Install-SublimePackagesFromCache -Directory $packageCache
|
||||||
Install-SublimePackageControl
|
Install-SublimePackageControl
|
||||||
$packageControl = (Join-Path $current 'Package Control.sublime-settings')
|
$packageControl = (Join-Path $current 'Package Control.sublime-settings')
|
||||||
Merge-PackageControlSettings -FilePath $packageControl
|
Merge-PackageControlSettings -FilePath $packageControl
|
||||||
|
@@ -24,6 +24,30 @@ function Get-SublimeUserPath
|
|||||||
return $path
|
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
|
function Install-SublimePackageControl
|
||||||
{
|
{
|
||||||
# install package control
|
# install package control
|
||||||
|
Reference in New Issue
Block a user