Skip to content

Commit

Permalink
enabling sublime_guard even when bundler isn't being used
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon Black committed Jul 23, 2012
1 parent 81884f8 commit 45d4f79
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
7 changes: 2 additions & 5 deletions guard.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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")
Expand Down
9 changes: 7 additions & 2 deletions run_guard.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 45d4f79

Please sign in to comment.