Class: Stefon::Surveyor::AddedFiles

Inherits:
Base
  • Object
show all
Defined in:
lib/stefon/surveyor/added_files.rb

Overview

This class gives points to the top commiter of the repo proportionally to each file that a user adds

Instance Attribute Summary

Attributes inherited from Base

#scores, #weight

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Stefon::Surveyor::Base

Instance Method Details

#callObject



8
9
10
# File 'lib/stefon/surveyor/added_files.rb', line 8

def call
  score_added_files.weight_scores(@weight)
end

#call_verboseObject



12
13
14
15
16
17
18
# File 'lib/stefon/surveyor/added_files.rb', line 12

def call_verbose
  # There is only 1 top commiter
  author = GitUtil.top_commiter.first
  Surveyor::SurveyorStore[[
    [author, ["The top commiter in this repo is: #{author}"]]
  ]]
end

#score_added_filesObject



20
21
22
23
24
25
# File 'lib/stefon/surveyor/added_files.rb', line 20

def score_added_files
  if (num_added_files = @grit.repo.status.added.count) > 0
    @scores[GitUtil.top_commiter] += num_added_files
  end
  @scores
end