EthanBrown.SublimeText2.GitPackages
- Sublime package featuring the best Git helpers - EditorConfig, Git, GitHubinator, Modific, SideBarGit, Github Gists - Also includes a custom keybinding package hosted on GitHub - Merges in customized settings for User Preferences
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
<?xml version="1.0"?>
|
||||
<package xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<metadata>
|
||||
<id>EthanBrown.SublimeText2.GitPackages</id>
|
||||
<title>Sublime Text 2 - Git Integration Packages</title>
|
||||
<version>0.0.1</version>
|
||||
<authors>Various</authors>
|
||||
<owners>Ethan Brown</owners>
|
||||
<summary>A number of packages helpful for increased editor productivity when using Git.</summary>
|
||||
<description>Includes a number of very useful packages for Sublime Text 2.
|
||||
|
||||
Included
|
||||
===========================================================================
|
||||
|
||||
- EditorConfig
|
||||
https://github.com/sindresorhus/editorconfig-sublime
|
||||
|
||||
- Git
|
||||
https://github.com/kemayo/sublime-text-2-git
|
||||
|
||||
- GitHubinator
|
||||
https://github.com/ehamiter/ST2-GitHubinator
|
||||
|
||||
- Modific
|
||||
https://github.com/gornostal/Modific
|
||||
|
||||
- SideBarGit
|
||||
https://github.com/SublimeText/SideBarGit
|
||||
|
||||
- sublime-github (Github Gists)
|
||||
https://github.com/bgreenlee/sublime-github
|
||||
|
||||
Customized Key Bindings
|
||||
===========================================================================
|
||||
https://github.com/Iristyle/SublimeKeyMap.Git
|
||||
|
||||
Additional Package Preferences
|
||||
===========================================================================
|
||||
Git - Commit message rules
|
||||
Github Gists - Generates an OAuth token automatically
|
||||
SideBarGit - disables branch since Git already supplies it
|
||||
|
||||
Additional User Preferences
|
||||
===========================================================================
|
||||
Rules for
|
||||
- drawing whitespace
|
||||
- ensuring newline at eof
|
||||
- rulers at 50, 72, 80 and 120
|
||||
- use spaces everywhere
|
||||
- trim whitespace on save
|
||||
</description>
|
||||
<projectUrl>http://github.com/Iristyle/ChocolateyPackages/</projectUrl>
|
||||
<tags>SublimeText package editor</tags>
|
||||
<!-- Eula is in installer
|
||||
<licenseUrl></licenseUrl>
|
||||
-->
|
||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||
<iconUrl>https://raw.github.com/Iristyle/ChocolateyPackages/master/SublimeText2.app/Sublime_Text.png</iconUrl>
|
||||
<releaseNotes></releaseNotes>
|
||||
<dependencies>
|
||||
<dependency id="PowerShell" version="3.0"/>
|
||||
<dependency id="SublimeText2.app" />
|
||||
</dependencies>
|
||||
</metadata>
|
||||
<files>
|
||||
<file src="tools\**" target="tools" />
|
||||
<file src="..\core\JsonHelpers.ps1" target="tools" />
|
||||
<file src="..\core\SublimeHelpers.ps1" target="tools" />
|
||||
</files>
|
||||
</package>
|
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"rulers": [50, 72]
|
||||
}
|
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"accounts": {
|
||||
"GitHub": {
|
||||
"base_uri": "https://api.github.com",
|
||||
"github_token": ""
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"installed_packages":
|
||||
[
|
||||
"EditorConfig",
|
||||
"Git",
|
||||
"GitHubinator",
|
||||
"Modific",
|
||||
"SideBarGit",
|
||||
"sublime-github",
|
||||
"ZZZ.EthanBrown.SublimeKeyMap.Git"
|
||||
],
|
||||
"package_name_map": {
|
||||
"SublimeKeyMap.Git": "ZZZ.EthanBrown.SublimeKeyMap.Git"
|
||||
},
|
||||
"repositories":
|
||||
[
|
||||
"https://github.com/Iristyle/SublimeKeyMap.Git"
|
||||
]
|
||||
}
|
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"draw_white_space": "all",
|
||||
"ensure_newline_at_eof_on_save": true,
|
||||
"rulers":
|
||||
[
|
||||
50,
|
||||
72,
|
||||
80,
|
||||
120
|
||||
],
|
||||
"translate_tabs_to_spaces": true,
|
||||
"trim_trailing_white_space_on_save": true
|
||||
}
|
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"statusbar_branch" : false
|
||||
}
|
@@ -0,0 +1,81 @@
|
||||
$package = 'EthanBrown.SublimeText2.GitPackages'
|
||||
|
||||
function Get-CurrentDirectory
|
||||
{
|
||||
$thisName = $MyInvocation.MyCommand.Name
|
||||
[IO.Path]::GetDirectoryName((Get-Content function:$thisName).File)
|
||||
}
|
||||
|
||||
try {
|
||||
$current = Get-CurrentDirectory
|
||||
|
||||
. (Join-Path $current 'JsonHelpers.ps1')
|
||||
. (Join-Path $current 'SublimeHelpers.ps1')
|
||||
|
||||
$sublimeUserDataPath = Get-SublimeUserPath
|
||||
|
||||
#straight file copies
|
||||
'Git Commit Message.sublime-settings',
|
||||
'GitHub.sublime-settings',
|
||||
'SideBarGit.sublime-settings' |
|
||||
% {
|
||||
$params = @{
|
||||
Path = Join-Path $current $_;
|
||||
Destination = Join-Path $sublimeUserDataPath $_;
|
||||
Force = $true
|
||||
}
|
||||
Copy-Item @params
|
||||
}
|
||||
|
||||
$packageControl = Join-Path $current 'Package Control.sublime-settings'
|
||||
Merge-PackageControlSettings -FilePath $packageControl
|
||||
|
||||
$preferences = Join-Path $current 'Preferences.sublime-settings'
|
||||
Merge-Preferences -FilePath $preferences
|
||||
|
||||
if (Get-Process -Name sublime_text -ErrorAction SilentlyContinue)
|
||||
{
|
||||
Write-Warning 'Please close and re-open Sublime Text to force packages to update'
|
||||
}
|
||||
|
||||
Write-Host @'
|
||||
To take advantage of the GitHub Gist plugin, generate an OAuth token.
|
||||
|
||||
In Powershell this can be done by copying the following code into the shell:
|
||||
|
||||
function Setup-SublimeGitHub
|
||||
{
|
||||
$userName = Read-Host -Prompt "Enter GitHub Username"
|
||||
$password = Read-Host -Prompt "Enter GitHub Password"
|
||||
|
||||
$postData = @{ scopes = @("repo"); note = "Sublime Plugin Token" }
|
||||
$params = @{
|
||||
Uri = "https://api.github.com/authorizations";
|
||||
Method = "POST";
|
||||
Headers = @{
|
||||
Authorization = "Basic " + [Convert]::ToBase64String(
|
||||
[Text.Encoding]::ASCII.GetBytes("$($userName):$($password)"));
|
||||
}
|
||||
ContentType = "application/json";
|
||||
Body = (ConvertTo-Json $postData -Compress)
|
||||
}
|
||||
|
||||
$GITHUB_API_OUTPUT = Invoke-RestMethod @params
|
||||
|
||||
$token = $GITHUB_API_OUTPUT | Select -ExpandProperty Token
|
||||
Write-Host "New OAuth token is $token"
|
||||
|
||||
$configFile = "$ENV:APPDATA\Sublime Text 2\Packages\User\GitHub.sublime-settings"
|
||||
$json = (Get-Content $configFile) -join "" | ConvertFrom-Json
|
||||
$json.accounts.GitHub.github_token = $token
|
||||
$json | ConvertTo-Json | Out-File $configFile -Force
|
||||
}
|
||||
|
||||
Setup-SublimeGitHub
|
||||
'@
|
||||
|
||||
Write-ChocolateySuccess $package
|
||||
} catch {
|
||||
Write-ChocolateyFailure $package "$($_.Exception.Message)"
|
||||
throw
|
||||
}
|
Reference in New Issue
Block a user