Class: Git

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

Constant Summary collapse

Commands =
YAML.load(%Q{

  authors: git log --since="#{ARGV[0]}-01" --before="#{ARGV[1]}-01" --pretty=format:"%an"
  stats:
    complete: git log --since="#{ARGV[0]}-01" --before="#{ARGV[1]}-01" --stat --pretty=format:"%an"
    current_month: git log --no-merges --oneline --author="%{author}" --after=30.days.ago --stat --pretty=format:"%s"

})
Logs =
OpenStruct.new(
  authors: `#{Commands["authors"]}`.split(/\n/).uniq,
  complete: `#{Commands["stats"]["complete"]}`.split(/\n\n/),
  current_month: ->(author){
    `#{Commands["stats"]["current_month"].sub(/%{author}/, author)}`.split(/\n\n/)
  }
)
TOTAL =
Logs.complete.reduce(0) do |count, commit|
  count += Builder.(commit).changes
end