Method: GitHelpers::GitStats#stats_lines
- Defined in:
- lib/git_helpers/stats.rb
#stats_lines(file) ⇒ Object
inspired by visionmedia//git-line-summary
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/git_helpers/stats.rb', line 43 def stats_lines(file) out="" with_dir do out,_suc=SH.run_simple("git", "blame", "--line-porcelain", file, quiet: true) end r={} begin out.each_line do |l| l.match(/^author (.*)/) do |m| r[m[1]]||=0 r[m[1]]+=1 end end rescue => e warn "Warning: #{e} on #{file}" end r end |