以下の内容はhttps://blog.nishimu.land/entry/20081213/1229136631より取得しました。


Railsのrake statsの再現

研究で自分がどれくらいテストを書いているのか、を見える化する為に使っているRakeタスク

CODE = FileList['lib/**/*.rb'] 
SPEC = FileList['spec/**/*.rb'] 
desc 'Report code-spec ratio' 
task :stats do  
  code  = `wc -l #{CODE}`.split(/ /)[-2] 
  spec  = `wc -l #{SPEC}`.split(/ /)[-2] 
  ratio = "%.1f" % (spec.to_f / code.to_f) 
 
  max_width = [[code, spec].map(&:length).max, 4].max 
  left   = lambda {|s| s.to_s.ljust(max_width) } 
  right  = lambda {|s| s.to_s.rjust(max_width) } 
 
  puts right['code'] + ' : ' + left['spec'] 
  puts right[code]   + ' : ' + left[spec] 
  puts right[1]      + ' : ' + left[ratio] 
end

もしかすると抜けとかがあるかもしれない。
目安くらいに考える。




以上の内容はhttps://blog.nishimu.land/entry/20081213/1229136631より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14