Skip to content

Instantly share code, notes, and snippets.

@kirkelifson
Last active July 24, 2019 21:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kirkelifson/1a4c1ea783f7f06bd9240bd4c9082a79 to your computer and use it in GitHub Desktop.
Save kirkelifson/1a4c1ea783f7f06bd9240bd4c9082a79 to your computer and use it in GitHub Desktop.
good git hooks for rails
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