From aa76f0590b2b9a0c0b3bc944e75b406afcc9e65e Mon Sep 17 00:00:00 2001 From: Gleb Averchuk Date: Fri, 20 Feb 2015 22:18:19 +0300 Subject: [PATCH] add "internal_dir" option to sublime-settings --- RubyTest.sublime-settings | 4 +++- run_ruby_test.py | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/RubyTest.sublime-settings b/RubyTest.sublime-settings index 63daf07..c7d6628 100644 --- a/RubyTest.sublime-settings +++ b/RubyTest.sublime-settings @@ -32,6 +32,8 @@ "theme": "Packages/RubyTest/TestConsole.hidden-tmTheme", "syntax": "Packages/RubyTest/TestConsole.tmLanguage", - "terminal_encoding": "utf-8" + "terminal_encoding": "utf-8", + // the internal project directory where ruby code is located and "spec" directory presented + "internal_dir": "." } diff --git a/run_ruby_test.py b/run_ruby_test.py index 8f41e23..dace7cd 100644 --- a/run_ruby_test.py +++ b/run_ruby_test.py @@ -134,7 +134,7 @@ def load_config(self): global SYNTAX; SYNTAX = s.get('syntax') global THEME; THEME = s.get('theme') global TERMINAL_ENCODING; TERMINAL_ENCODING = s.get('terminal_encoding') - + global INTERNAL_DIR; INTERNAL_DIR = s.get("internal_dir") rbenv = s.get("check_for_rbenv") rvm = s.get("check_for_rvm") @@ -202,6 +202,9 @@ def run_shell_command(self, command, working_dir): self.save_test_run(command, working_dir) if COMMAND_PREFIX: command = COMMAND_PREFIX + ' ' + command + if INTERNAL_DIR and INTERNAL_DIR != ".": + command = re.sub(r"" + INTERNAL_DIR + "\/", "", command) + working_dir += "/" + INTERNAL_DIR if int(sublime.version().split('.')[0]) <= 2: command = [command] self.view.window().run_command("exec", {