Permalink
Browse files

Better project directory and source file tests

The current tests fail if a user stores *all* their source code in a
~/src directory

Test for ebin because it's required by the rebar layout, and is more
erlang specific.

Test for exclusion of .eunit. Not sure if there are other .erl files
we'd want to ignore.
  • Loading branch information...
1 parent 4b333b8 commit 27dc992f166050ba81ddadaa103077537b2b54b5 @jwheare jwheare committed with Oct 31, 2012
Showing with 4 additions and 4 deletions.
  1. +2 −2 sublimerl_core.py
  2. +2 −2 support/sublimerl_libparser.py
View
@@ -240,8 +240,8 @@ def set_project_roots(self):
self.test_root = os.path.abspath(file_test_root)
def find_project_roots(self, current_dir, project_root_candidate=None, file_test_root_candidate=None):
- # if rebar.config or a src directory exists, save as potential candidate
- if os.path.exists(os.path.join(current_dir, 'rebar.config')) or os.path.exists(os.path.join(current_dir, 'src')):
+ # if rebar.config or an ebin directory exists, save as potential candidate
+ if os.path.exists(os.path.join(current_dir, 'rebar.config')) or os.path.exists(os.path.join(current_dir, 'ebin')):
# set project root candidate
project_root_candidate = current_dir
# set test root candidate if none set yet
@@ -58,8 +58,8 @@ def generate_completions(self, starting_dir, dest_file_base):
rel_dirs.append(root)
# loop filenames ending in .erl
for filename in fnmatch.filter(filenames, r"*.erl"):
- if 'src' in root.split('/'):
- # source file in a src directory
+ if '.eunit' not in root.split('/'):
+ # exclude eunit files
filepath = os.path.join(root, filename)
# check if in release directory
if not (True in [filepath.find(rel_dir) != -1 for rel_dir in rel_dirs]):

0 comments on commit 27dc992

Please sign in to comment.