Class: Diggit::DevelopersActivity::Analyses::ProjectDevelopersAnalysis

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

Overview

Records the activity of developers at the project level, ie, the date at which developers commit

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



32
33
34
# File 'lib/diggit/developers_activity/analyses/project_developers_analysis.rb', line 32

def clean
	db.client[COL].find({ project: @source.url }).delete_many
end

#runObject

Since:

  • 0.0.1



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/diggit/developers_activity/analyses/project_developers_analysis.rb', line 13

def run
	super
	puts('Extracting project-level activity')

	r_last = repo.lookup(src_opt[@source]["R_last"])
	r_first = repo.lookup(src_opt[@source]["R_first"])

	walker = Rugged::Walker.new(repo)
	walker.push_range("#{r_first.oid}..#{r_last.oid}")
	devs = []
	walker.each do |commit|
		t = commit.author[:time]
		author = Authors.get_author(commit)
		devs << { project: @source.url, author: author, time: t }
	end

	db.insert(COL, devs)
end