Created
October 17, 2009 05:50
-
-
Save garybernhardt/212258 to your computer and use it in GitHub Desktop.
This file contains 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
# Loop through git revisions, counting lines of Python | |
# code, unit test code, cucumber code, and media. The | |
# paths and filenames are specific to my project; if | |
# you want to use this, you'll have to change them. | |
reverse() { | |
sed 'x;1!H;$!d;x' | |
} | |
(echo 'rev,python code,unit test,cucumber,media' && | |
git rev-list HEAD | | |
reverse | | |
while read rev; do | |
git co $rev | |
echo "\ | |
$rev \ | |
, \ | |
`find . -iname '*.py' | grep -v tests.py | xargs cat | wc -l` \ | |
, \ | |
`find . -iname 'tests.py' | xargs cat | wc -l` \ | |
, \ | |
`find features | grep -v watir | xargs cat | wc -l` \ | |
, \ | |
`find static | xargs cat | wc -l` \ | |
" | sed 's/[[:space:]]//g' | |
done 2>/dev/null) > stats.csv | |
# As I originally typed it: | |
(echo 'rev,python code,unit test,cucumber,media' && git rev-list HEAD | sed 'x;1!H;$!d;x' | while read rev; do git co $rev; echo "$rev,`find . -iname '*.py' | grep -v tests.py | xargs cat | wc -l`,`find . -iname 'tests.py' | xargs cat | wc -l`,`find features | grep -v watir | xargs cat | wc -l`,`find static | xargs cat | wc -l`"; done 2>/dev/null) > stats.csv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment