Draft Game and Challenge models
[vchess.git] / countLines.sh
1 #!/bin/bash
2 # Count code lines ( using answer https://stackoverflow.com/a/965072 )
3
4 function countFoldExt()
5 {
6 count=0
7 for fullfile in `find $1`; do
8 filename=$(basename -- "$fullfile")
9 extension="${filename##*.}"
10 if [ "$extension" == "$2" ]; then
11 count=$((count+`wc -l $fullfile | grep -o ^[0-9]*`))
12 fi
13 done
14 echo $count
15 }
16
17 count=0
18 count=$((count + $(countFoldExt "app.js" "js")))
19 count=$((count + $(countFoldExt "gulpfile.js" "js")))
20 count=$((count + $(countFoldExt "sockets.js" "js")))
21 count=$((count + $(countFoldExt "bin" "www")))
22 count=$((count + $(countFoldExt "config" "js")))
23 count=$((count + $(countFoldExt "db" "sql")))
24 count=$((count + $(countFoldExt "models" "js")))
25 count=$((count + $(countFoldExt "public" "js")))
26 count=$((count + $(countFoldExt "public" "sass")))
27 count=$((count + $(countFoldExt "routes" "js")))
28 count=$((count + $(countFoldExt "utils" "js")))
29 count=$((count + $(countFoldExt "views" "pug")))
30 echo $count