Created
January 17, 2016 22:56
-
-
Save sergigp/e57e51aa086c7102a089 to your computer and use it in GitHub Desktop.
Pre commit for scala projects
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
RED='\033[0;31m' | |
GREEN='\033[0;32m' | |
NC='\033[0m' | |
echo -e "\n\033[1mDoing some Checks...\n\033[0m" | |
if sbt compile > /dev/null | |
then | |
echo -e "${GREEN}- Compiles${NC}" | |
else | |
echo -e "${RED}- Code not compiles${NC} (do 'sbt compile' for more information)" | |
exit 1 | |
fi | |
if sbt test > /dev/null | |
then | |
echo -e "${GREEN}- Tests passing${NC}" | |
else | |
echo -e "${RED}- Tests do not pass${NC} (do 'sbt test' for more information)" | |
exit 1 | |
fi | |
if sbt scalastyle > /dev/null | |
then | |
echo -e "${GREEN}- Code style${NC}" | |
echo -e "\nAll Ok, your code will be commited young padawan.\n" | |
else | |
echo -e "${RED}- Code Style not ok${NC} (do 'sbt scalastyle' for more information)" | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Won't be faster, but colored log printing is cleaner. Just a cosmetic change:
https://gist.github.com/jordiclariana/4dda8b811fb43ad6d988