diff --git a/SublimeText2.PackageControl/SublimeText2.PackageControl.nuspec b/SublimeText2.PackageControl/SublimeText2.PackageControl.nuspec
index 5ad457f..46613ca 100644
--- a/SublimeText2.PackageControl/SublimeText2.PackageControl.nuspec
+++ b/SublimeText2.PackageControl/SublimeText2.PackageControl.nuspec
@@ -3,7 +3,7 @@
SublimeText2.PackageControl
Sublime Text 2 Package Control
- 1.6.3
+ 2.0.1-beta1
Will Bond
Ethan J Brown
A full-featured package manager that helps discovering, installing, updating and removing packages for Sublime Text 2. It features an automatic upgrader and supports GitHub, BitBucket and a full channel/repository system.
@@ -25,6 +25,7 @@
+
diff --git a/SublimeText2.PackageControl/tools/ChocolateyInstall.ps1 b/SublimeText2.PackageControl/tools/ChocolateyInstall.ps1
index f14b834..ff6aab5 100644
--- a/SublimeText2.PackageControl/tools/ChocolateyInstall.ps1
+++ b/SublimeText2.PackageControl/tools/ChocolateyInstall.ps1
@@ -9,8 +9,13 @@ try {
$current = Get-CurrentDirectory
. (Join-Path $current 'SublimeHelpers.ps1')
+ . (Join-Path $current 'JsonHelpers.ps1')
- Install-SublimePackageControl
+ # TODO: come up with a better way to do this install / set this setting
+ # that will work based on the semver in this packages .nuspec file
+ Install-SublimePackageControl -PreRelease
+ $packageControl = Join-Path $current 'Package Control.sublime-settings'
+ Merge-PackageControlSettings -FilePath $packageControl
Write-ChocolateySuccess $package
} catch {
diff --git a/SublimeText2.PackageControl/tools/Package Control.sublime-settings b/SublimeText2.PackageControl/tools/Package Control.sublime-settings
new file mode 100644
index 0000000..835b2d9
--- /dev/null
+++ b/SublimeText2.PackageControl/tools/Package Control.sublime-settings
@@ -0,0 +1,3 @@
+{
+ "install_prereleases": true
+}
diff --git a/core/SublimeHelpers.ps1 b/core/SublimeHelpers.ps1
index 7d3c596..d66c284 100644
--- a/core/SublimeHelpers.ps1
+++ b/core/SublimeHelpers.ps1
@@ -93,7 +93,11 @@ function Install-SublimePackageControl
[Parameter(Mandatory = $false)]
[ValidateRange(2,3)]
[int]
- $Version = 2
+ $Version = 2,
+
+ [Parameter(Mandatory = $false)]
+ [Switch]
+ $PreRelease = $false
)
# install package control
@@ -107,12 +111,15 @@ function Install-SublimePackageControl
2 {
$packageControl = Join-Path $packagesPath 'Package Control.sublime-package'
- if (!(Test-Path $packageControl))
+ 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)
{
- # http://wbond.net/sublime_packages/package_control/installation
- $packageUrl = 'http://sublime.wbond.net/Package%20Control.sublime-package'
- Get-ChocolateyWebFile -url $packageUrl -fileFullPath $packageControl
+ $packageUrl = 'https://sublime.wbond.net/prerelease/Package%20Control.sublime-package'
}
+ Get-ChocolateyWebFile -url $packageUrl -fileFullPath $packageControl
}
3 {
@@ -151,16 +158,31 @@ function Merge-PackageControlSettings
$new = ConvertFrom-Json ([IO.File]::ReadAllText($FilePath))
- # simple arrays
- 'installed_packages', 'repositories' |
+ $simpleArrays = @('installed_packages', 'repositories', 'channels',
+ 'auto_upgrade_ignore', 'git_update_command', 'hg_update_command',
+ 'dirs_to_ignore', 'files_to_ignore', 'files_to_include',
+ 'files_to_ignore_binary', 'files_to_include_binary' )
+ $simpleArrays |
? { $new.$_ -ne $null } |
% { Merge-JsonArray -Name $_ -Destination $existing -Array $new.$_ }
- # maps
- 'package_name_map' |
+ $maps = @('package_name_map')
+ $maps |
? { $new.$_ -ne $null } |
% { Merge-JsonSimpleMap -Name $_ -Destination $existing -SimpleMap $new.$_ }
+ $arrayOfMaps = @('certs')
+ $arrayOfMaps |
+ ? { $new.$_ -ne $null } |
+ % { Merge-JsonArrayOfSimpleMap -Name $_ -Destination $existing -Array $new.$_ }
+
+ $excluded = $simpleArrays + $maps + $arrayOfMaps
+ $new.PSObject.Properties |
+ ? { $excluded -inotcontains $_.Name } |
+ % {
+ Merge-JsonNamedValue -Name $_.Name -Destination $existing -Value $_.Value
+ }
+
$json = $existing | ConvertTo-Json -Depth 10 | ConvertFrom-UnicodeEscaped
Write-Verbose "Updated settings: `n`n$json`n"
[IO.File]::WriteAllText($existingPath, $json, [System.Text.Encoding]::ASCII)