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



39
40
41
# File 'lib/diggit/developers_activity/analyses/project_developers_analysis.rb', line 39

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
31
32
33
34
35
36
37
# File 'lib/diggit/developers_activity/analyses/project_developers_analysis.rb', line 13

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

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

	walker = Rugged::Walker.new(repo)
	if src_opt[@source].nil?
		walker.push(repo.head.target.oid)
	else
		walker.push_range("#{r_first.oid}..#{r_last.oid}")
	end
	devs = []
	walker.each do |commit|
		t = commit.author[:time]
		author = Authors.get_author(commit)
		puts "plop #{author}"
		devs << { project: @source.url, author: author, time: t }
	end

	db.insert(COL, devs)
end