Sha256: f8712f14f6a1409c01de5ed2c755416e7253de17dea25217685cad8bb1dfa6ae
Contents?: true
Size: 789 Bytes
Versions: 3
Compression:
Stored size: 789 Bytes
Contents
require 'time' class GitStat def initialize(git) @git = git end def stats commits = [] @git.stat_history.each_line do |line| if line =~ /^commit:/ commits << {} commits.last[:commit] = line[/^commit: (.*?) /, 1] commits.last[:time] = Time.parse(line[/^commit: .*? (.*)/, 1]) elsif line =~ /^\d/ commits.last[:affected_files] ||= [] commits.last[:affected_files] << {} commits.last[:affected_files].last[:file] = line[/^\d+\s\d+\s(.*)$/, 1] insertions = line[/^(\d+)/, 1] deletions = line[/^(\d+) (\d+)/, 2] commits.last[:affected_files].last[:insertions] = insertions.to_i commits.last[:affected_files].last[:deletions] = deletions.to_i end end commits end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
git_heat-0.2.0 | lib/git_heat/git_stat.rb |
git_heat-0.1.0 | lib/git_heat/git_stat.rb |
git_heat-0.0.1 | lib/git_heat/git_stat.rb |