Skip to content

Instantly share code, notes, and snippets.

@maephisto
Last active August 29, 2015 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maephisto/b7ed482fd28182abd879 to your computer and use it in GitHub Desktop.
Save maephisto/b7ed482fd28182abd879 to your computer and use it in GitHub Desktop.
git prepush hook
#!/bin/sh
echo "\nLet me check if you can push this!"
echo "\nExecuting unit tests..."
testValidationResult=$(grunt test | grep "Done, without errors")
if [ "$testValidationResult" != "" ]; then
echo "\033[32mUnit tests execution passed. Wow, such tests, much green!\033[0m"
else
echo "\033[31mUnit tests execution failed. And what do we say to the god of Pu$
exit 1
fi
echo "\033[32mPushing...\033[0m"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment