From 5796a381b7c67368136300cbb7fbc94b1ad06b5e Mon Sep 17 00:00:00 2001 From: Iristyle Date: Mon, 15 Sep 2014 11:36:50 -0700 Subject: [PATCH] (chore ST3 package control): release 2.0.0 final - Remove dependency on Git - Add dependency on JsonHelpers.ps1 - Properly remove any previously Git installed package control - Install for ST3 the same way we install for ST3 --- .../SublimeText3.PackageControl.nuspec | 4 +- .../tools/chocolateyInstall.ps1 | 1 + core/SublimeHelpers.ps1 | 52 ++++++++++--------- 3 files changed, 31 insertions(+), 26 deletions(-) diff --git a/SublimeText3.PackageControl/SublimeText3.PackageControl.nuspec b/SublimeText3.PackageControl/SublimeText3.PackageControl.nuspec index 1bf1cef..9eb1c2b 100644 --- a/SublimeText3.PackageControl/SublimeText3.PackageControl.nuspec +++ b/SublimeText3.PackageControl/SublimeText3.PackageControl.nuspec @@ -3,7 +3,7 @@ SublimeText3.PackageControl Sublime Text 3 Package Control - 2.0.0.20130723 + 2.0.0.20140915 Will Bond Ethan J Brown A full-featured package manager that helps discovering, installing, updating and removing packages for Sublime Text 3. It features an automatic upgrader and supports GitHub, BitBucket and a full channel/repository system. @@ -20,12 +20,12 @@ false https://github.com/Iristyle/ChocolateyPackages/raw/master/SublimeText2.app/Sublime_Text.png - + diff --git a/SublimeText3.PackageControl/tools/chocolateyInstall.ps1 b/SublimeText3.PackageControl/tools/chocolateyInstall.ps1 index 5ac542d..f118cca 100644 --- a/SublimeText3.PackageControl/tools/chocolateyInstall.ps1 +++ b/SublimeText3.PackageControl/tools/chocolateyInstall.ps1 @@ -8,6 +8,7 @@ try { $package = 'SublimeText3.PackageControl' $current = Get-CurrentDirectory + . (Join-Path $current 'JsonHelpers.ps1') . (Join-Path $current 'SublimeHelpers.ps1') Install-SublimePackageControl -Version 3 diff --git a/core/SublimeHelpers.ps1 b/core/SublimeHelpers.ps1 index 900d5ed..3990ab5 100644 --- a/core/SublimeHelpers.ps1 +++ b/core/SublimeHelpers.ps1 @@ -91,6 +91,18 @@ function Install-SublimePackagesFromCache } } +# clean up any previous installation attempts that were Git clnoe based +function Remove-GitInstalledSublimePackageControl +{ + $installPath = 'Packages\Package Control' + $packagesPath = Join-Path (Get-SublimeSettingsPath -Version $Version) $installPath + if (Test-Path $packagesPath) + { + Write-Host "Removing previously Git installed Package Control from $packagesPath" + Remove-Item $packagesPath -Recurse -Force -ErrorAction SilentlyContinue + } +} + function Install-SublimePackageControl { [CmdletBinding()] @@ -105,37 +117,29 @@ function Install-SublimePackageControl $PreRelease = $false ) + # remove Git cloned version if it exists + if ($Version -eq 3) { Remove-GitInstalledSublimePackageControl } + # install package control - $packageFolder = if ($Version -eq 2) { 'Installed Packages' } else { 'Packages' } + $packageFolder = 'Installed Packages' $packagesPath = Join-Path (Get-SublimeSettingsPath -Version $Version) $packageFolder if (!(Test-Path $packagesPath)) { New-Item $packagesPath -Type Directory } - switch ($Version) + $packageControl = Join-Path $packagesPath 'Package Control.sublime-package' + + if (Test-Path $packageControl) { Remove-item $packageControl } + + # http://wbond.net/sublime_packages/package_control/installation + $packageUrl = 'http://sublime.wbond.net/Package%20Control.sublime-package' + if ($PreRelease) { - 2 { - $packageControl = Join-Path $packagesPath 'Package Control.sublime-package' - - if (Test-Path $packageControl) { Remove-item $packageControl } - - # http://wbond.net/sublime_packages/package_control/installation - $packageUrl = 'http://sublime.wbond.net/Package%20Control.sublime-package' - if ($PreRelease) - { - $packageUrl = 'https://sublime.wbond.net/prerelease/Package%20Control.sublime-package' - } - Get-ChocolateyWebFile -url $packageUrl -fileFullPath $packageControl - - $settings = @{ 'install_prereleases' = $PreRelease } - Merge-PackageControlSettings -Settings $settings -Version $Version - } - - 3 { - Push-Location $packagesPath - git clone -b python3 https://github.com/wbond/sublime_package_control.git "Package Control" - Pop-Location - } + $packageUrl = 'https://sublime.wbond.net/prerelease/Package%20Control.sublime-package' } + Get-ChocolateyWebFile -url $packageUrl -fileFullPath $packageControl + + $settings = @{ 'install_prereleases' = $PreRelease } + Merge-PackageControlSettings -Settings $settings -Version $Version } function Merge-PackageControlSettings