diff --git a/SublimeText3.PowershellAlias/SublimeText3.PowershellAlias.nuspec b/SublimeText3.PowershellAlias/SublimeText3.PowershellAlias.nuspec new file mode 100644 index 0000000..00ef406 --- /dev/null +++ b/SublimeText3.PowershellAlias/SublimeText3.PowershellAlias.nuspec @@ -0,0 +1,21 @@ + + + + SublimeText3.PowershellAlias + Sublime Text 3 Powershell subl Alias + 0.1.0 + Jon Skinner + Ethan J Brown + A Powershell 'subl' alias to easily launch Sublime Text 3 from the command line. Sublime Text 3 is a sophisticated text editor for code, html and prose. + Assumes Sublime Text 3 is already installed to the default location on disk. + + http://www.sublimetext.com/3 + sublime text editor powershell + http://www.sublimetext.com/eula + false + https://github.com/Iristyle/ChocolateyPackages/raw/master/SublimeText2.app/Sublime_Text.png + + + + + diff --git a/SublimeText3.PowershellAlias/tools/chocolateyInstall.ps1 b/SublimeText3.PowershellAlias/tools/chocolateyInstall.ps1 new file mode 100644 index 0000000..5e8821b --- /dev/null +++ b/SublimeText3.PowershellAlias/tools/chocolateyInstall.ps1 @@ -0,0 +1,21 @@ +try { + $package = 'SublimeText3.PowershellAlias' + + $sublDefined = Test-Path function:subl + $profileExists = Test-Path $PROFILE + $sublInProfile = $profileExists -and (((Get-Content $PROFILE) -match '^function\s+subl\s+\.*Sublime Text 3').Count -gt 0) + + # add subl alias to powershell profile + if (!$sublDefined -and !$sublInProfile) + { + New-Item (Split-Path $PROFILE) -Type Directory -ErrorAction SilentlyContinue + 'function subl { &"${Env:ProgramFiles}\Sublime Text 3\sublime_text.exe" $args }' | + Out-File -FilePath $PROFILE -Append -Encoding UTF8 + Write-Host 'Added subl alias to Powershell profile to launch Sublime Text 3!' + } + + Write-ChocolateySuccess $package +} catch { + Write-ChocolateyFailure $package "$($_.Exception.Message)" + throw +}