-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 6c507cc
Showing
6 changed files
with
101 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[ | ||
{ "keys": ["super+b"], "command": "build_switcher" } | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[ | ||
{ "keys": ["super+b"], "command": "build_switcher" } | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[ | ||
{ "keys": ["super+b"], "command": "build_switcher" } | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# BuildSwitcher (Sublime Text 2 plugin) | ||
|
||
Do you have multiple build systems per project ? This plugin will help you quickly execute the one you want. | ||
|
||
## Instalation | ||
Recommended way is using [PackageControll] package. | ||
|
||
Or you can download the [tarball] and extract it to your `~/Library/Application Support/Sublime Text 2/Packages/BuildSwitcher`. | ||
|
||
## Configuration | ||
There is currently no way to get list of available build systems in [Sublime], so you need to explicitly specify the ones you wanna list. Just add into your `XXX.sublime-project` something like this: | ||
|
||
```` | ||
{ | ||
"settings": { | ||
"build_switcher_systems": ["Unit tests", "CoffeeScript"] | ||
} | ||
} | ||
```` | ||
|
||
If you don't specify any build system, BuildSwitcher will just execute the currently selected build (the same behavior as Sublime's default `super+b` shortcut). | ||
|
||
If you specify only one build system, it will execute it without asking. | ||
|
||
If you specify multiple systems, you always get a pop up with options (sorted by usage). | ||
|
||
## Defining key shortcut | ||
By default, "build_switcher" is mapped to `CMD+B`, however you can easily change that, just add to your keymap preferences: | ||
|
||
```` | ||
{ "keys": ["super+b"], "command": "build_switcher" } | ||
```` | ||
|
||
|
||
|
||
[Sublime]: http://www.sublimetext.com/ | ||
[PackageControll]: http://wbond.net/sublime_packages/package_control/installation | ||
[tarball]: https://github.com/vojtajina/sublime-BuildSwitcher/tarball/master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
from sublime_plugin import WindowCommand | ||
|
||
|
||
class BuildSwitcherCommand(WindowCommand): | ||
|
||
def __init__(self, window): | ||
WindowCommand.__init__(self, window) | ||
|
||
settings = self.window.active_view().settings() | ||
settings.add_on_change("build_switcher_systems", self._reload_settings) | ||
self._reload_settings() | ||
|
||
|
||
def _reload_settings(self): | ||
settings = self.window.active_view().settings() | ||
self.available_systems = settings.get("build_switcher_systems") | ||
|
||
|
||
def run(self): | ||
win = self.window | ||
|
||
if not self.available_systems: | ||
# no switcher builds - just do selected build | ||
win.run_command("build") | ||
elif len(self.available_systems) is 1: | ||
# only one build system - just run it | ||
self._run_build(0) | ||
else: | ||
# more options, show the popup | ||
win.show_quick_panel(self.available_systems, self._run_build) | ||
|
||
|
||
def _run_build(self, idx): | ||
# the dialog was cancelled | ||
if idx is -1: return | ||
|
||
self.window.run_command("set_build_system", {"file": self.available_systems[idx]}) | ||
self.window.run_command("build") | ||
|
||
# move the last used system to first position | ||
self.available_systems.insert(0, self.available_systems.pop(idx)) | ||
|
||
|
||
def is_enabled(self): | ||
return True | ||
|
||
|
||
def description(self): | ||
return "Pop up a dialog with available build commands." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"version": "0.0.1", | ||
"url": "https://github.com/vojtajina/sublime-BuildSwitcher", | ||
"description": "Bring a pop up to decide which build you wanna run." | ||
} |