quattro_4 scribble

scribble 落書き (調べた事をただ落書きする)

git_statistics

実行の流れ

/bin/git_statistics

#!/usr/bin/env ruby

require 'git_statistics'

GitStatistics::GitStatistics.new(ARGV).execute

lib/git_statistics.rb

require 'git_statistics/initialize'

module GitStatistics
  class GitStatistics
    def initialize(args = nil)
      @opts = Trollop::options do
        opt :email, "Use author's email instead of name", :default => false
        ...
        opt :verbose, "Verbose output (shows progress)", :default => false
        opt :limit, "The maximum limit of commits to hold in memory at a time", :default => 100
      end
    end

    def execute
      # Collect data (incremental or fresh) based on presence of old data
      if @opts[:update]

外部ライブラリ

Linguist - projectの言語などの情報を解析(取得)する
github/linguist · GitHub

Grit - gitをRubyで操作できる、使った事ある
mojombo/grit · GitHub

Trollop - a commandline option parser
jashmenn/trollop · GitHub

output

lib/git_statistics/results.rb

普通に
output += "-"*87 + とか
output += "\n" とかやってる