public
Description: A very fast & simple Ruby web server
Homepage: http://code.macournoyer.com/thin/
Clone URL: git://github.com/macournoyer/thin.git
Search Repo:
Add more stats in rake task
macournoyer (author)
Tue Feb 05 11:27:08 -0800 2008
commit  2b6fef8cddc67ed9a7dc8e935f29a9221d56ac77
tree    5434357583637768b2252fbddcfa354f6f1c55d0
parent  5a0965b38c1c83db9d69ec4aeaad3505888cade3
...
3
4
5
6
7
8
9
 
 
 
 
 
 
 
10
11
12
13
14
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
...
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
0
@@ -3,14 +3,27 @@
0
   line_count = proc do |path|
0
     Dir[path].collect { |f| File.open(f).readlines.reject { |l| l =~ /(^\s*(\#|\/\*))|^\s*$/ }.size }.inject(0){ |sum,n| sum += n }
0
   end
0
- lib = line_count['lib/**/*.rb']
0
- ext = line_count['ext/**/*.{c,h}']
0
- spec = line_count['spec/**/*.rb']
0
- ratio = '%1.2f' % (spec.to_f / lib.to_f)
0
+ comment_count = proc do |path|
0
+ Dir[path].collect { |f| File.open(f).readlines.select { |l| l =~ /^\s*\#/ }.size }.inject(0) { |sum,n| sum += n }
0
+ end
0
+ lib = line_count['lib/**/*.rb']
0
+ comment = comment_count['lib/**/*.rb']
0
+ ext = line_count['ext/**/*.{c,h}']
0
+ spec = line_count['spec/**/*.rb']
0
   
0
- puts "#{lib.to_s.rjust(6)} LOC of lib"
0
- puts "#{ext.to_s.rjust(6)} LOC of ext"
0
- puts "#{spec.to_s.rjust(6)} LOC of spec"
0
- puts "#{ratio.to_s.rjust(6)} ratio lib/spec"
0
+ comment_ratio = '%1.2f' % (comment.to_f / lib.to_f)
0
+ spec_ratio = '%1.2f' % (spec.to_f / lib.to_f)
0
+
0
+ puts '/======================\\'
0
+ puts '| Part LOC |'
0
+ puts '|======================|'
0
+ puts "| lib #{lib.to_s.ljust(5)}|"
0
+ puts "| lib comments #{comment.to_s.ljust(5)}|"
0
+ puts "| ext #{ext.to_s.ljust(5)}|"
0
+ puts "| spec #{spec.to_s.ljust(5)}|"
0
+ puts '| ratios: |'
0
+ puts "| lib/comment #{comment_ratio.to_s.ljust(5)}|"
0
+ puts "| lib/spec #{spec_ratio.to_s.ljust(5)}|"
0
+ puts '\======================/'
0
 end

Comments

    No one has commented yet.