Permalink
Browse files

enabling sublime_guard even when bundler isn't being used

  • Loading branch information...
1 parent 81884f8 commit 45d4f79517e5efc0d7bdd3553744a9394484e374 @brandonblack brandonblack committed Jul 23, 2012
Showing with 9 additions and 7 deletions.
  1. +2 −5 guard.py
  2. +7 −2 run_guard.sh
View
@@ -32,14 +32,11 @@ def open_folder_paths(self):
def path_has_guardfile(self, path):
return os.path.exists(path + '/Guardfile')
- def path_has_gemfile(self, path):
- return os.path.exists(path + '/Gemfile')
-
def find_project_root_path(self):
project_root_path = None
for path in self.open_folder_paths():
print "Checking ... " + path
- if (self.path_has_guardfile(path) and self.path_has_gemfile(path)):
+ if (self.path_has_guardfile(path)):
project_root_path = path
break
return project_root_path
@@ -63,7 +60,7 @@ def set_permissions(self, path):
def start_guard(self):
project_root_path = self.find_project_root_path()
if (project_root_path == None):
- sublime.error_message("Failed to find Guardfile and Gemfile in any of the open folders.")
+ sublime.error_message("Failed to find Guardfile in any of the open folders.")
else:
package_path = sublime.packages_path()
self.set_permissions(package_path + "/Guard/guard_wrapper")
View
@@ -37,8 +37,13 @@ function load_rvm_as_a_function() {
}
function run_guard() {
- printf "Running 'bundle exec guard'. All output/failures from this point on is from the 'bundle exec guard' command.\n\n"
- cd "$1" && bundle exec guard
+ if [[ -s "Gemfile" ]] ; then
+ printf "Running 'bundle exec guard'. All output/failures from this point on is from the 'bundle exec guard' command.\n\n"
+ cd "$1" && bundle exec guard
+ else
+ printf "Running 'guard'. All output/failures from this point on is from the 'guard' command.\n\n"
+ cd "$1" && guard
+ fi
}
echo "Starting Guard for $1"

0 comments on commit 45d4f79

Please sign in to comment.