Skip to content
This repository has been archived by the owner on Mar 21, 2018. It is now read-only.

Commit

Permalink
style(hooks): Only trigger hooks when ruby files have been changed
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelastic committed Jul 21, 2015
1 parent 22fe658 commit e6ac7f1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions scripts/git_hooks/pre-commit
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/usr/bin/env bash

# Succeed fast if we did not change any ruby file
if ! git status --short | grep -q '\.rb$'; then
exit 0
fi

# Do not commit any focused or excluded tests
if grep --color -r 'spec' -E -e '^( |\t)*(fit|fdescribe|xit|xdescribe)'; then
echo '✘ You have focused and/or skipped tests'
Expand Down
6 changes: 6 additions & 0 deletions scripts/git_hooks/pre-push
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
#!/usr/bin/env bash

# Succeed fast if we did not change any ruby file
if ! git status --short | grep -q '\.rb$'; then
exit 0
fi

rake spec || exit 1

# No over-complex methods
Expand Down

0 comments on commit e6ac7f1

Please sign in to comment.