Sha256: cceb1aece35055ecb3bcd0252b09bceacf4956b6582e57b9849a852c3987e7e4

Contents?: true

Size: 771 Bytes

Versions: 21

Compression:

Stored size: 771 Bytes

Contents

module Churn

  #analizes git SCM to find recently changed files, and what lines have been altered
  class GitAnalyzer < SourceControl
    def get_logs
      `git log #{date_range} --name-only --pretty=format:`.split(/\n/).reject{|line| line == ""}
    end
    
    def get_revisions
      `git log #{date_range} --pretty=format:"%H"`.split(/\n/).reject{|line| line == ""}
    end
    
    private

    def get_diff(revision, previous_revision)
      `git diff #{revision} #{previous_revision} --unified=0`.split(/\n/).select{|line| line.match(/^@@/) || line.match(/^---/) || line.match(/^\+\+\+/) }
    end

    def date_range
      if @start_date
        date = Chronic.parse(@start_date)
        "--after=#{date.strftime('%Y-%m-%d')}"
      end
    end
    
  end
end

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
churn-0.0.33 lib/churn/git_analyzer.rb
churn-0.0.32 lib/churn/git_analyzer.rb
churn-0.0.31 lib/churn/git_analyzer.rb
churn-0.0.30 lib/churn/git_analyzer.rb
churn-0.0.29 lib/churn/git_analyzer.rb
churn-0.0.28 lib/churn/git_analyzer.rb
churn-0.0.27 lib/churn/git_analyzer.rb
churn-0.0.26 lib/churn/git_analyzer.rb
churn-0.0.25 lib/churn/git_analyzer.rb
churn-0.0.24 lib/churn/git_analyzer.rb
churn-0.0.23 lib/churn/git_analyzer.rb
churn-0.0.22 lib/churn/git_analyzer.rb
churn-0.0.21 lib/churn/git_analyzer.rb
churn-0.0.20 lib/churn/git_analyzer.rb
churn-0.0.19 lib/churn/git_analyzer.rb
rferraz-churn-0.0.19 lib/churn/git_analyzer.rb
rferraz-churn-0.0.17 lib/churn/git_analyzer.rb
rferraz-churn-0.0.16 lib/churn/git_analyzer.rb
churn-0.0.15 lib/churn/git_analyzer.rb
churn-0.0.14 lib/churn/git_analyzer.rb