Skip to content

Ruby can't see parser #18

@ciobanucos

Description

@ciobanucos

Can anyone tell my why gltail can't see this parser?

#
# Place this file in gltail/lib/gl_tail/parsers/gitlogfu.rb
#
# Parser which handles the output of following 'git log' command.
#
# git log --pretty='format:%ct <%an>' --shortstat -z | tr '\n\0' ' \n' | sort -n
#
class GitLogFuParser < Parser

  def parse(line)
    @yesterday ||= Time.at(0)
    if line =~ /(\d+) <(.*?)>\s+(\d+) files changed, (\d+) insertions..., (\d+) deletions/
      today = Time.at($1.to_i)
      author = $2
      files = $3.to_i
      inserts = $4.to_i
      deletes = $5.to_i

      add_activity(:block => 'insertions', :name => author, :size => inserts) if inserts > 0
      add_activity(:block => 'deletions', :name => author, :size => deletes) if deletes > 0

      add_event(:block => 'insertions', :name => author, :message => today.strftime('%B %d, %Y'), 
                :update_stats => false, :color => [0.4, 0.4, 0.4, 1.0]) if today.day != @yesterday.day && today.wday == 0

      @yesterday = today

    end
  end

end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions