Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jocelynmallon committed May 1, 2012
0 parents commit 9fd92ba
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SourcetreeCommand.pyc
package-metadata.json
7 changes: 7 additions & 0 deletions Context.sublime-menu
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[
{ "caption": "-" },
{
"caption": "SourceTree",
"command": "sourcetree"
}
]
12 changes: 12 additions & 0 deletions Main.sublime-menu
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[
{
"id": "tools",
"children":
[
{
"caption": "SourceTree",
"command": "sourcetree"
}
]
}
]
22 changes: 22 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Sublime Text 2 - SourceTree menu plugin
===============================================

Adds a handy menu item that opens [SourceTree](http://www.sourcetreeapp.com/).

![screenshot](http://i.imgur.com/Td9aj.jpg)

Adapted from the excellent [Github for mac](https://github.com/csytan/sublime-text-2-github) plugin for Sublime Text by Chris Tan

Instructions
-------------

* Install [SourceTree](http://www.sourcetreeapp.com/)
* Download [sublime-text-2-sourcetree](https://github.com/jocelynmallon/sublime-text-2-sourcetree/zipball/master) and copy unzipped folder to your Sublime Text 2 packages folder.
* You can find your packages folder through the following menus:
**Sublime Text 2** -> **Preferences** -> **Browse Packages**
* Restart Sublime Text

Usage
-----
* Open a file from a git repo in Sublime Text
* Go to **Tools** -> **SourceTree**
16 changes: 16 additions & 0 deletions SourcetreeCommand.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import os
import subprocess

import sublime
import sublime_plugin


class SourcetreeCommand(sublime_plugin.WindowCommand):
def run(self):
filename = self.window.active_view().file_name()
dirname = os.path.dirname(filename)
while dirname != '/':
if '.git' in os.listdir(dirname):
return subprocess.call(['open', '-a', 'SourceTree', dirname])
dirname = os.path.dirname(dirname)
subprocess.call(['open', '-a', 'SourceTree'])
20 changes: 20 additions & 0 deletions packages.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"schema_version": "1.1",
"packages": [
{
"name": "SourceTree.app Menu",
"author": "Jocelyn Mallon",
"description": "Open SourceTree.app from your menu",
"homepage": "https://github.com/jocelynmallon/sublime-text-2-sourcetree",
"last_modified": "2012-05-01 12:45:30",
"platforms": {
"osx": [
{
"version": "1.0.0",
"url": "https://github.com/jocelynmallon/sublime-text-2-sourcetree/zipball/master"
}
]
}
}
]
}

0 comments on commit 9fd92ba

Please sign in to comment.