Created
September 21, 2012 01:21
-
-
Save SimianLogic/3759265 to your computer and use it in GitHub Desktop.
copy SublimeRubyMotionBuilder breakpoints to the root of a RubyMotion project and format them for RM's gdb
This file contains hidden or 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
class RubyMotionDebug(sublime_plugin.WindowCommand): | |
def run(self, options=""): | |
view = self.window.active_view() | |
if not view: | |
return | |
dir_name = FindRubyMotionRakefile(os.path.split(view.file_name())[0]) | |
if dir_name: | |
#COPIES BREAKPOINTS (REQUIRES GDB... PROBABLY A CLEANER WAY TO DO THIS) | |
window = self.window | |
window.run_command("gdb_open_breakpoint_view") | |
bp_view = window.views()[-1] | |
window.focus_view(window.views()[-1]) | |
time.sleep(0.1) | |
bp_view.run_command("select_all") | |
bp_view.run_command("copy") | |
window.run_command("close") | |
file_name = os.path.join(dir_name, "debugger_cmds") | |
f = open(file_name, 'w') | |
rm_break = re.sub(r'-1 - \/.*/app/', 'break ', sublime.get_clipboard()) | |
f.write(rm_break) | |
f.close() | |
#go back to the window we were in | |
window.focus_view(view) | |
#END BREAKPOINT COPY | |
sh_name = os.path.join(this_dir, "rubymotion_debug.sh") | |
file_regex = "^(...*?):([0-9]*):([0-9]*)" | |
# build console is not required for Run | |
#self.window.run_command("hide_panel", {"panel": "output.exec"}) | |
settings = sublime.load_settings("Preferences.sublime-settings") | |
show_panel_on_build = settings.get("show_panel_on_build", True) | |
if show_panel_on_build: | |
# temporary setting to keep console visibility | |
settings.set("show_panel_on_build", False) | |
self.window.run_command("exec", {"cmd": ["sh", sh_name, dir_name, options], "working_dir": dir_name, "file_regex": file_regex}) | |
# setting recovery | |
settings.set("show_panel_on_build", show_panel_on_build) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment