git pushしてから、ciで数分後にコケましたってなるのがイライラしすぎたので、gitのpre-commit時点で全部叩くだけ
#!/bin/bash
git diff --cached --name-only --diff-filter=AM | grep '\.rb$' | xargs bundle exec rubocop
cop=$?
git diff --cached --name-only --diff-filter=AM | grep '^app/.*\.rb$' | xargs bundle exec spec
spec=$?
git diff --cached --name-only --diff-filter=AM | grep '^app/assets/stylesheets/.*\.scss$' | xargs bundle exec scss-lint
scss=$?
git diff --cached --name-only --diff-filter=AM | grep '^app/views/.*\.haml$' | xargs bundle exec haml-lint
haml=$?
exit $(($cop || $spec || $scss || $haml))
chmod a+x .git/hooks/pre-commit
あとはgit commit -vして待つだけ