Class: Gitstats::Stats

Inherits:
Object
  • Object
show all
Defined in:
lib/gitstats.rb

Constant Summary collapse

@@authors =
Hash.new
@@result =
'Running git log --stat -M'

Instance Method Summary collapse

Instance Method Details



220
221
222
223
224
225
226
227
228
# File 'lib/gitstats.rb', line 220

def print_commits
  if @@authors.size > 0
    puts "\nTop 10 commits by lines changed:"
    @@authors.each do |k, v|
      puts "\n#################\nAuthor #{k}:"
      v.print_commits_sorted
    end
  end
end


204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
# File 'lib/gitstats.rb', line 204

def print_info
  puts @@result, "\n"
  if @@authors.size > 0
    sorted_authors = @@authors.keys.sort { |y, x| @@authors[y].total_commits <=> @@authors[x].total_commits }
    sorted_authors.each do |k|
      v = @@authors[k]
      puts "Author #{k}:"
      puts "  Total # of commits:       #{v.total_commits}"
      puts "  Total # of files changed: #{v.total_files}"
      puts "  Total # of lines changed: #{v.total_lines}"
      puts "             # of inserts:    #{v.total_inserts}"
      puts "             # of deletes:    #{v.total_deletes}"
    end
  end
end