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



35
36
37
# File 'lib/diggit/developers_activity/analyses/project_developers_analysis.rb', line 35

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
# 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_time = repo.lookup(src_opt[@source]["R_first"]).author[:time]

  walker = Rugged::Walker.new(repo)
  walker.sorting(Rugged::SORT_DATE)
  walker.push(r_last)

  devs = []
  walker.each do |commit|
    t = commit.author[:time]
    author = Authors.get_author(commit)
    devs << { project: @source.url, author: author, time: t }

    break if t < r_first_time
  end

  db.insert(COL, devs)
end