Created
January 4, 2018 22:18
-
-
Save ArthurNagy/77c7c5a6fb358993b8a7e678b0d49fc4 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
#!/bin/sh | |
project_dir=$1 | |
cd $project_dir | |
stats_for_month(){ | |
java_files="$(find \. -mindepth 1 -type f -name '*.java' -print)" | |
kotlin_files="$(find \. -mindepth 1 -type f -name '*.kt' -print)" | |
java_files_nr=$(echo "$java_files" | wc -l) | |
kotlin_files_nr=$(echo "$kotlin_files" | wc -l) | |
java_code_nr=$(echo "$java_files" | xargs cat | awk '/[a-zA-Z0-9]/ {i++} END{print i}') | |
kotlin_code_nr=$(echo "$kotlin_files" | xargs cat | awk '/[a-zA-Z0-9]/ {i++} END{print i}') | |
echo "Stats for: $1" | |
echo " Java: files: $java_files_nr, code lines: $java_code_nr" | |
echo " Kotlin: files: $kotlin_files_nr, code lines: $kotlin_code_nr" | |
} | |
checkout_by_month(){ | |
for m in 1 2 3 4 5 6 7 8 9 10 11 12; do | |
date=$(echo $(date -d $m/1/1 +%b) $(date -d "$(($m%12+1))/1 - 1 days - 1 year" +%d) $(date -d "- 1 year" +%Y)) | |
git -c advice.detachedHead=false checkout `git rev-list -1 --before="$date" develop` -q | |
stats_for_month "$date" | |
done | |
} | |
checkout_by_month |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment