Permalink
Browse files

Added configurable directory ignore

  • Loading branch information...
1 parent cf3d813 commit 638fadd431c70edba331c4e086b18dbf1e7d310c @jetaggart jetaggart committed Aug 18, 2012
Showing with 8 additions and 5 deletions.
  1. +2 −1 .gitignore
  2. +2 −1 RubyTest.sublime-settings
  3. +4 −3 run_ruby_test.py
View
@@ -1,2 +1,3 @@
*.cache
-*.pyc
+*.pyc
+.DS_Store
@@ -9,5 +9,6 @@
"ruby_rspec_folder": "spec",
"ruby_use_scratch" : false,
- "save_on_run": false
+ "save_on_run": false,
+ "ignored_directories": [".git", "vendor", "tmp"]
}
View
@@ -94,6 +94,7 @@ def load_config(self):
global CUCUMBER_UNIT_FOLDER; CUCUMBER_UNIT_FOLDER = s.get("ruby_cucumber_folder")
global RSPEC_UNIT_FOLDER; RSPEC_UNIT_FOLDER = s.get("ruby_rspec_folder")
global USE_SCRATCH; USE_SCRATCH = s.get("ruby_use_scratch")
+ global IGNORED_DIRECTORIES; IGNORED_DIRECTORIES = s.get("ignored_directories")
if s.get("save_on_run"):
self.window().run_command("save_all")
@@ -252,6 +253,7 @@ def run(self, args):
class SwitchBetweenCodeAndTest(BaseRubyTask):
def is_enabled(self): return 'switch_to_test' in self.file_type().features()
def run(self, args, split_view):
+ self.load_config()
possible_alternates = self.file_type().possible_alternate_files()
alternates = self.project_files(lambda file: file in possible_alternates)
if alternates:
@@ -276,10 +278,9 @@ def on_selected(self, alternates, index):
self.window().open_file(alternates[index])
- def walk(self, directory, ignored_directories = []):
- ignored_directories = ['.git', 'vendor'] # Move this into config
+ def walk(self, directory):
for dir, dirnames, files in os.walk(directory):
- dirnames[:] = [dirname for dirname in dirnames if dirname not in ignored_directories]
+ dirnames[:] = [dirname for dirname in dirnames if dirname not in IGNORED_DIRECTORIES]
yield dir, dirnames, files
def project_files(self, file_matcher):

0 comments on commit 638fadd

Please sign in to comment.