refactor(sublime pkg control): move install script
- Will need this for other packages to more safely ensure package control is setup
This commit is contained in:
@@ -25,5 +25,6 @@
|
|||||||
</metadata>
|
</metadata>
|
||||||
<files>
|
<files>
|
||||||
<file src="tools\**" target="tools" />
|
<file src="tools\**" target="tools" />
|
||||||
|
<file src="..\core\SublimeHelpers.ps1" target="tools" />
|
||||||
</files>
|
</files>
|
||||||
</package>
|
</package>
|
||||||
|
@@ -1,19 +1,16 @@
|
|||||||
|
function Get-CurrentDirectory
|
||||||
|
{
|
||||||
|
$thisName = $MyInvocation.MyCommand.Name
|
||||||
|
[IO.Path]::GetDirectoryName((Get-Content function:$thisName).File)
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$package = 'SublimeText2.PackageControl'
|
$package = 'SublimeText2.PackageControl'
|
||||||
|
|
||||||
# install package control
|
$current = Get-CurrentDirectory
|
||||||
$installPath = Join-Path $Env:ProgramFiles 'Sublime Text 2'
|
. (Join-Path $current 'SublimeHelpers.ps1')
|
||||||
$sublimeDataPath = Join-Path ([Environment]::GetFolderPath('ApplicationData')) 'Sublime Text 2'
|
|
||||||
$packagesPath = Join-Path $sublimeDataPath 'Installed Packages'
|
|
||||||
if (!(Test-Path $packagesPath)) { New-Item $packagesPath -Type Directory }
|
|
||||||
$packageControl = Join-Path $packagesPath 'Package Control.sublime-package'
|
|
||||||
|
|
||||||
if (!(Test-Path $packageControl))
|
Install-SublimePackageControl
|
||||||
{
|
|
||||||
# http://wbond.net/sublime_packages/package_control/installation
|
|
||||||
$packageUrl = 'http://sublime.wbond.net/Package%20Control.sublime-package'
|
|
||||||
Get-ChocolateyWebFile -url $packageUrl -fileFullPath $packageControl
|
|
||||||
}
|
|
||||||
|
|
||||||
Write-ChocolateySuccess $package
|
Write-ChocolateySuccess $package
|
||||||
} catch {
|
} catch {
|
||||||
|
@@ -1,10 +1,17 @@
|
|||||||
# uses functions in JsonHelpers.ps1
|
# uses functions in JsonHelpers.ps1
|
||||||
|
function Get-SublimeInstallPath
|
||||||
|
{
|
||||||
|
Join-Path $Env:ProgramFiles 'Sublime Text 2'
|
||||||
|
}
|
||||||
|
|
||||||
|
function Get-SublimeSettingsPath
|
||||||
|
{
|
||||||
|
Join-Path ([Environment]::GetFolderPath('ApplicationData')) 'Sublime Text 2'
|
||||||
|
}
|
||||||
|
|
||||||
function Get-SublimePackagesPath
|
function Get-SublimePackagesPath
|
||||||
{
|
{
|
||||||
$installPath = Join-Path $Env:ProgramFiles 'Sublime Text 2'
|
$packagesPath = Join-Path (Get-SublimeSettingsPath) 'Packages'
|
||||||
$settingsPath = Join-Path ([Environment]::GetFolderPath('ApplicationData')) 'Sublime Text 2'
|
|
||||||
$packagesPath = Join-Path $settingsPath 'Packages'
|
|
||||||
if (!(Test-Path $packagesPath)) { New-Item $packagesPath -Type Directory }
|
if (!(Test-Path $packagesPath)) { New-Item $packagesPath -Type Directory }
|
||||||
|
|
||||||
return $packagesPath
|
return $packagesPath
|
||||||
@@ -17,6 +24,21 @@ function Get-SublimeUserPath
|
|||||||
return $path
|
return $path
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Install-SublimePackageControl
|
||||||
|
{
|
||||||
|
# install package control
|
||||||
|
$packagesPath = Join-Path (Get-SublimeSettingsPath) 'Installed Packages'
|
||||||
|
if (!(Test-Path $packagesPath)) { New-Item $packagesPath -Type Directory }
|
||||||
|
$packageControl = Join-Path $packagesPath 'Package Control.sublime-package'
|
||||||
|
|
||||||
|
if (!(Test-Path $packageControl))
|
||||||
|
{
|
||||||
|
# http://wbond.net/sublime_packages/package_control/installation
|
||||||
|
$packageUrl = 'http://sublime.wbond.net/Package%20Control.sublime-package'
|
||||||
|
Get-ChocolateyWebFile -url $packageUrl -fileFullPath $packageControl
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function Merge-PackageControlSettings
|
function Merge-PackageControlSettings
|
||||||
{
|
{
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
|
Reference in New Issue
Block a user