Skip to content

Instantly share code, notes, and snippets.

@stephanos
Created April 5, 2016 08:41
Show Gist options
  • Save stephanos/039e442ac927e3cafe2256458cd5af08 to your computer and use it in GitHub Desktop.
Save stephanos/039e442ac927e3cafe2256458cd5af08 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
weeks=90
echo "all"
echo "java"
echo "groovy"
echo "js"
echo "specs"
echo "all;java;groovy;js;spec"
for i in $(seq 1 $weeks)}
do
read all <<< `git log --numstat --pretty="%H" --since="${i} weeks ago" --until="$((i - 1)) weeks ago" | awk 'NF==3 {if ( match($3, /.*/) ) { plus+=$1 } } END {printf("%d\n", plus)}'`
read java <<< `git log --numstat --pretty="%H" --since="${i} weeks ago" --until="$((i - 1)) weeks ago" | awk 'NF==3 {if ( match($3, /\.java/) ) { plus+=$1 } } END {printf("%d\n", plus)}'`
read groovy <<< `git log --numstat --pretty="%H" --since="${i} weeks ago" --until="$((i - 1)) weeks ago" | awk 'NF==3 {if ( match($3, /\.groovy$/) ) { plus+=$1 } } END {printf("%d\n", plus)}'`
read js <<< `git log --numstat --pretty="%H" --since="${i} weeks ago" --until="$((i - 1)) weeks ago" | awk 'NF==3 {if ( match($3, /.js$/) && ! match($3, /spec\.js$/) ) { plus+=$1 } } END {printf("%d\n", plus)}'`
read spec <<< `git log --numstat --pretty="%H" --since="${i} weeks ago" --until="$((i - 1)) weeks ago" | awk 'NF==3 {if ( match($3, /(spec.coffee|spec.js)$/) ) { plus+=$1 } } END {printf("%d\n", plus)}'`
echo "$all;$java;$groovy;$js;$spec"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment