Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ruby can't see parser #18

Open
ciobanucos opened this issue Nov 30, 2011 · 0 comments
Open

Ruby can't see parser #18

ciobanucos opened this issue Nov 30, 2011 · 0 comments

Comments

@ciobanucos
Copy link

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant