Permalink
Browse files

ensure contextual menu CT results tests work

  • Loading branch information...
1 parent 7d1df17 commit 64a78a96939e8298298d536b602777c463586680 @ostinelli committed Apr 25, 2012
Showing with 11 additions and 9 deletions.
  1. +11 −9 sublimerl.py
View
20 sublimerl.py
@@ -33,7 +33,7 @@
SUBLIMERL_VERSION = '0.2-dev'
SUBLIMERL_LAST_TEST = None
SUBLIMERL_LAST_TEST_TYPE = None
-SUBLIMERL_LAST_ROOT = None
+CURRENT_PROJECT_ROOT = None
# core launcher & panel
@@ -164,7 +164,8 @@ def get_exe_path(self, name):
def set_env(self):
self.env = os.environ.copy()
# add project root
- self.env['PATH'] = "%s:%s" % (self.env['PATH'], SUBLIMERL_LAST_ROOT)
+ global CURRENT_PROJECT_ROOT
+ self.env['PATH'] = "%s:%s" % (self.env['PATH'], CURRENT_PROJECT_ROOT)
# TODO: enhance the finding of paths
if sublime.platform() == 'osx':
# get relevant file paths
@@ -205,20 +206,20 @@ def get_erlang_module_name(self):
return m.group(1)
def set_cwd_to_otp_project_root(self):
- global SUBLIMERL_LAST_ROOT
+ global CURRENT_PROJECT_ROOT
# get otp directory
current_file_path = os.path.dirname(self.view.file_name())
otp_project_root = self.get_otp_project_root(current_file_path)
if otp_project_root == None:
- SUBLIMERL_LAST_ROOT = None
+ CURRENT_PROJECT_ROOT = None
return False
# save
- SUBLIMERL_LAST_ROOT = os.path.abspath(otp_project_root)
+ CURRENT_PROJECT_ROOT = os.path.abspath(otp_project_root)
# TODO: SWITCH THIS set current directory to root - needed by rebar
- os.chdir(SUBLIMERL_LAST_ROOT)
+ os.chdir(CURRENT_PROJECT_ROOT)
def get_otp_project_root(self, current_dir, project_root_candidate=None):
# if rebar.config exists, stop walking up
@@ -234,8 +235,8 @@ def get_otp_project_root(self, current_dir, project_root_candidate=None):
return self.get_otp_project_root(os.sep.join(current_dir_split), project_root_candidate)
def get_project_root(self):
- global SUBLIMERL_LAST_ROOT
- return SUBLIMERL_LAST_ROOT
+ global CURRENT_PROJECT_ROOT
+ return CURRENT_PROJECT_ROOT
def execute_os_command(self, os_cmd, block=False):
p = subprocess.Popen(os_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True, env=self.env)
@@ -544,5 +545,6 @@ def run_command(self, edit):
if os.path.exists(index_path): webbrowser.open(index_path)
def show_contextual_menu(self):
- return SUBLIMERL_LAST_ROOT != None
+ index_path = os.path.abspath(os.path.join(CURRENT_PROJECT_ROOT, 'logs', 'index.html'))
+ return os.path.exists(index_path)

0 comments on commit 64a78a9

Please sign in to comment.