Skip to content

Instantly share code, notes, and snippets.

@barkerja
Created November 30, 2012 01:32
Show Gist options
  • Save barkerja/4173161 to your computer and use it in GitHub Desktop.
Save barkerja/4173161 to your computer and use it in GitHub Desktop.
#!/bin/sh
files=`git diff --cached --name-status | awk '{print $2}'`
count_javascript=`grep -iR 'console\.log' $files | wc -l | awk '{print $1}'`
count_ruby=`grep -R 'logger\.debug' $files | wc -l | awk '{print $1}'`
if [[ "$count_javascript" -ge 1 ]]; then
echo "Remove any config.log() statements left in javascript sources"
echo ""
echo $count_javascript " javascript file(s) to fix:"
echo "**********"
grep -iR 'console\.log' $files | awk -F ":" '{print $1}'
echo "**********"
exit 1
fi
if [[ "$count_ruby" -ge 1 ]]; then
echo "Remove any logger.debug statements left in ruby sources."
echo ""
echo $count_ruby " ruby file(s) to fix:"
echo "**********"
grep -iR 'logger\.debug' $files | awk -F ":" '{print $1}'
echo "**********"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment