-
Notifications
You must be signed in to change notification settings - Fork 237
/
Copy pathstat_codes.sh
executable file
·32 lines (29 loc) · 1.77 KB
/
stat_codes.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh
r1=`find app/ -name *.rb|grep -v admin|grep -v helper|grep -v locale|grep -v views|xargs cat|grep -v "^\s*#"|grep -v "^\s*$" |wc -l`
printf "Controllers: \t\t%s\n" $r1
r7=`find app/ -name *helpers.rb|grep -v admin|xargs cat|grep -v "^\s*#"|grep -v "^\s*$" |wc -l`
printf "Helpers: \t\t%s\n" $r7
r2=`find app/views -name *.erb|grep -v admin|xargs cat|grep -v "^\s*#"|grep -v "^\s*$" |wc -l`
printf "Views: \t\t\t%s\n" $r2
r3=`find models/ -name *.rb|grep -v admin|xargs cat|grep -v "^\s*#"|grep -v "^\s*$" |wc -l`
printf "Models: \t\t%s\n" $r3
r8=`find db/ -name *.rb|xargs cat|grep -v "^\s*#"|grep -v "^\s*$" |wc -l`
printf "DB & Migration: \t%s\n" $r8
r9=`find config -name *.rb|xargs cat|grep -v "^\s*#"|grep -v "^\s*$" |wc -l`
printf "Configuration: \t\t%s\n" $r9
r4=`find lib/ -name *.rb|grep -v admin|xargs cat|grep -v "^\s*#"|grep -v "^\s*$" |wc -l`
printf "Libraries: \t\t%s\n" $r4
r5=`find test/models -name *.rb|grep -v admin|xargs cat|grep -v "^\s*#"|grep -v "^\s*$" |wc -l`
printf "Unit test: \t\t%s\n" $r5
r6=`find test/app -name *.rb|grep -v admin|xargs cat|grep -v "^\s*#"|grep -v "^\s*$" |wc -l`
printf "Function test: \t\t%s\n" $r6
total=`expr $r1 + $r2 + $r3 + $r4 + $r5 + $r6 + $r7 + $r8 + $r9`
printf "Ruby code Lines: \t%s\n" $total
printf "All .rb files Lines: \t%s\n" `find . -name *.rb|grep -v admin|xargs cat|grep -v "^\s*#"|grep -v "^\s*$" |wc -l`
echo "-----------------------------------"
s1=`find public -name *.css|grep -v admin|xargs cat|grep -v "^\s*#"|grep -v "^\s*$" |wc -l`
s2=`find public -name *.js|grep -v admin|xargs cat|grep -v "^\s*#"|grep -v "^\s*$" |wc -l`
printf "StyleSheets: \t\t%s\n" $s1
printf "Javascripts: \t\t%s\n" $s2
echo "-----------------------------------"
printf "Total: \t\t\t%s\n" `expr $r1 + $r2 + $r3 + $r4 + $r5 + $r6 + $r7 + $r8 + $r9 + $s2`