-
-
Save doolin/7d19137e31e039ec6f7513c58d78c712 to your computer and use it in GitHub Desktop.
good git hooks for rails
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
| GREEN='\033[0;32m' | |
| RED='\033[0;31m' | |
| NC='\033[0m' | |
| print_fuck() { | |
| echo "${RED}" | |
| echo " █████▒█ ██ ▄████▄ ██ ▄█▀" | |
| echo "▓██ ▒ ██ ▓██▒▒██▀ ▀█ ██▄█▒ " | |
| echo "▒████ ░▓██ ▒██░▒▓█ ▄ ▓███▄░ " | |
| echo "░▓█▒ ░▓▓█ ░██░▒▓▓▄ ▄██▒▓██ █▄ " | |
| echo "░▒█░ ▒▒█████▓ ▒ ▓███▀ ░▒██▒ █▄" | |
| echo " ▒ ░ ░▒▓▒ ▒ ▒ ░ ░▒ ▒ ░▒ ▒▒ ▓▒" | |
| echo " ░ ░░▒░ ░ ░ ░ ▒ ░ ░▒ ▒░" | |
| echo " ░ ░ ░░░ ░ ░ ░ ░ ░░ ░ " | |
| echo " ░ ░ ░ ░ ░ " | |
| echo " ░ " | |
| echo "${NC}" | |
| } | |
| print_good_content() { | |
| echo "${GREEN}" | |
| if [ $(tput cols) -gt 105 ]; | |
| then | |
| echo "" | |
| echo " ██████╗ ██████╗ ██████╗ ██████╗ ██████╗ ██████╗ ███╗ ██╗████████╗███████╗███╗ ██╗████████╗██╗" | |
| echo "██╔════╝ ██╔═══██╗██╔═══██╗██╔══██╗ ██╔════╝██╔═══██╗████╗ ██║╚══██╔══╝██╔════╝████╗ ██║╚══██╔══╝██║" | |
| echo "██║ ███╗██║ ██║██║ ██║██║ ██║ ██║ ██║ ██║██╔██╗ ██║ ██║ █████╗ ██╔██╗ ██║ ██║ ██║" | |
| echo "██║ ██║██║ ██║██║ ██║██║ ██║ ██║ ██║ ██║██║╚██╗██║ ██║ ██╔══╝ ██║╚██╗██║ ██║ ╚═╝" | |
| echo "╚██████╔╝╚██████╔╝╚██████╔╝██████╔╝ ╚██████╗╚██████╔╝██║ ╚████║ ██║ ███████╗██║ ╚████║ ██║ ██╗" | |
| echo " ╚═════╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═╝ ╚══════╝╚═╝ ╚═══╝ ╚═╝ ╚═╝" | |
| echo "" | |
| else | |
| echo "" | |
| echo " ██████ ██▓ ▄████▄ ██ ▄█▀" | |
| echo "▒██ ▒ ▓██▒▒██▀ ▀█ ██▄█▒ " | |
| echo "░ ▓██▄ ▒██▒▒▓█ ▄ ▓███▄░ " | |
| echo " ▒ ██▒░██░▒▓▓▄ ▄██▒▓██ █▄ " | |
| echo "▒██████▒▒░██░▒ ▓███▀ ░▒██▒ █▄" | |
| echo "▒ ▒▓▒ ▒ ░░▓ ░ ░▒ ▒ ░▒ ▒▒ ▓▒" | |
| echo "░ ░▒ ░ ░ ▒ ░ ░ ▒ ░ ░▒ ▒░" | |
| echo "░ ░ ░ ▒ ░░ ░ ░░ ░ " | |
| echo " ░ ░ ░ ░ ░ ░ " | |
| echo " ░ " | |
| echo "" | |
| fi | |
| echo "${NC}" | |
| } | |
| check_var() { | |
| if [ $1 -eq 1 ]; | |
| then | |
| print_fuck | |
| exit 1 | |
| fi | |
| } | |
| echo "[+] rubocop" | |
| bundle exec rubocop -P | |
| rubocop=$? | |
| check_var $rubocop | |
| echo "[+] rspec" | |
| bundle exec rspec | |
| rspec=$? | |
| check_var $rspec | |
| echo "[+] bundle-audit" | |
| bundle exec bundle-audit check --update --quiet | |
| bundleaudit=$? | |
| check_var $bundleaudit | |
| echo "[+] brakeman" | |
| bundle exec brakeman -q | |
| brakeman=$? | |
| check_var $brakeman | |
| print_good_content | |
| exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment