Class: Diggit::DevelopersActivity::Analyses::ReleasesActivityAnalysis
- Inherits:
-
ActivityAnalysis
- Object
- Analysis
- ActivityAnalysis
- Diggit::DevelopersActivity::Analyses::ReleasesActivityAnalysis
show all
- Defined in:
- lib/diggit/developers_activity/analyses/releases_activity_analysis.rb
Overview
Instance Method Summary
collapse
#load_options
#extract_developers_activity
Instance Method Details
#clean ⇒ Object
41
42
43
|
# File 'lib/diggit/developers_activity/analyses/releases_activity_analysis.rb', line 41
def clean
db.client[COL_DEVELOPERS_RELEASE_ACTIVITY].find({ project: @source.url }).delete_many
end
|
#commits_between(new_commit, old_commit) ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/diggit/developers_activity/analyses/releases_activity_analysis.rb', line 13
def commits_between(new_commit, old_commit)
walker = Rugged::Walker.new(repo)
walker.sorting(Rugged::SORT_DATE)
walker.push(repo.lookup(new_commit))
t_old = repo.lookup(old_commit).author[:time]
commits = []
walker.each do |commit|
t_commit = commit.author[:time]
break if t_commit < t_old
commits << commit
end
commits
end
|
#run ⇒ Object
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/diggit/developers_activity/analyses/releases_activity_analysis.rb', line 29
def run
super
puts('Extract releases activity')
releases = src_opt[@source]["releases"]
(0..(releases.length - 2)).each do |i|
release_commits = commits_between(releases[i], releases[i + 1])
release_commits.each { |commit| Renames.(commit) }
m = (@source, release_commits, i)
db.insert(COL_DEVELOPERS_RELEASE_ACTIVITY, m) unless m.empty?
end
end
|