Class: Diggit::DevelopersActivity::Analyses::ReleasesActivityAnalysis

Inherits:
ActivityAnalysis
  • Object
show all
Defined in:
lib/diggit/developers_activity/analyses/releases_activity_analysis.rb

Overview

Since:

  • 0.0.1

Instance Method Summary collapse

Methods inherited from ActivityAnalysis

#load_options

Methods included from Diggit::DevelopersActivity::ActivityExtractor

#extract_developers_activity

Instance Method Details

#cleanObject

Since:

  • 0.0.1



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

Since:

  • 0.0.1



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

#runObject

Since:

  • 0.0.1



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.extract_commit_renames(commit) }
		m = extract_developers_activity(@source, release_commits, i)
		db.insert(COL_DEVELOPERS_RELEASE_ACTIVITY, m) unless m.empty?
	end
end