Class: Churn::GitAnalyzer
Overview
analizes git SCM to find recently changed files, and what lines have been altered
Class Method Summary
collapse
Instance Method Summary
collapse
#get_updated_files_change_info, #get_updated_files_from_log, #initialize, set_source_control
Class Method Details
.supported? ⇒ Boolean
6
7
8
|
# File 'lib/churn/scm/git_analyzer.rb', line 6
def self.supported?
!!(`git branch 2>&1` && $?.success?)
end
|
Instance Method Details
#generate_history(starting_point) ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/churn/scm/git_analyzer.rb', line 18
def generate_history(starting_point)
get_commit_history.each do |commit|
`git checkout #{commit}`
commit_date = `git show -s --format="%ci"`
commit_date = Time.parse(commit_date)
next if commit_date < starting_point
start_date = (commit_date - 7776000)
`churn -s "#{start_date}"`
end
ensure
`git checkout master`
end
|
#get_logs ⇒ Object
10
11
12
|
# File 'lib/churn/scm/git_analyzer.rb', line 10
def get_logs
`git log #{date_range} --name-only --pretty=format:`.split(/\n/).reject{|line| line == ""}
end
|
#get_revisions ⇒ Object
14
15
16
|
# File 'lib/churn/scm/git_analyzer.rb', line 14
def get_revisions
`git log #{date_range} --pretty=format:"%H"`.split(/\n/).reject{|line| line == ""}
end
|