Class: CommitHistory
- Inherits:
-
Object
- Object
- CommitHistory
- Defined in:
- lib/codespicuous/commithistory.rb
Instance Attribute Summary collapse
-
#commits ⇒ Object
readonly
Returns the value of attribute commits.
-
#committers ⇒ Object
readonly
Returns the value of attribute committers.
-
#repositories ⇒ Object
readonly
Returns the value of attribute repositories.
-
#teams ⇒ Object
readonly
Returns the value of attribute teams.
Instance Method Summary collapse
- #==(commit_history) ⇒ Object
- #add_commit(commit) ⇒ Object
- #add_commits(commits) ⇒ Object
- #add_team_member(team, member) ⇒ Object
- #amount_of_comitters ⇒ Object
- #amount_of_commits_for_team_in_week(team_name, week) ⇒ Object
- #committer(name) ⇒ Object
- #configure(teams, repositories) ⇒ Object
- #earliest_commit_date ⇒ Object
-
#initialize ⇒ CommitHistory
constructor
A new instance of CommitHistory.
- #latest_commit_date ⇒ Object
- #repository(name) ⇒ Object
- #repository_names ⇒ Object
- #team(name) ⇒ Object
Constructor Details
#initialize ⇒ CommitHistory
Returns a new instance of CommitHistory.
7 8 9 10 11 12 |
# File 'lib/codespicuous/commithistory.rb', line 7 def initialize @commits = Commits.new @teams = Teams.new @committers = teams.committers @repositories = Repositories.new end |
Instance Attribute Details
#commits ⇒ Object (readonly)
Returns the value of attribute commits.
5 6 7 |
# File 'lib/codespicuous/commithistory.rb', line 5 def commits @commits end |
#committers ⇒ Object (readonly)
Returns the value of attribute committers.
5 6 7 |
# File 'lib/codespicuous/commithistory.rb', line 5 def committers @committers end |
#repositories ⇒ Object (readonly)
Returns the value of attribute repositories.
5 6 7 |
# File 'lib/codespicuous/commithistory.rb', line 5 def repositories @repositories end |
#teams ⇒ Object (readonly)
Returns the value of attribute teams.
5 6 7 |
# File 'lib/codespicuous/commithistory.rb', line 5 def teams @teams end |
Instance Method Details
#==(commit_history) ⇒ Object
72 73 74 |
# File 'lib/codespicuous/commithistory.rb', line 72 def == commit_history @commits == commit_history.commits end |
#add_commit(commit) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/codespicuous/commithistory.rb', line 20 def add_commit(commit) @commits.add(commit) committer(commit.).add_commit(commit) @repositories.add(commit.repository) commit.repository.add_commit(commit) end |
#add_commits(commits) ⇒ Object
27 28 29 30 31 |
# File 'lib/codespicuous/commithistory.rb', line 27 def add_commits(commits) commits.each { |commit| add_commit(commit) } end |
#add_team_member(team, member) ⇒ Object
33 34 35 36 |
# File 'lib/codespicuous/commithistory.rb', line 33 def add_team_member(team, member) team = @teams.team(team) team.add_member(committer(member)) end |
#amount_of_comitters ⇒ Object
54 55 56 |
# File 'lib/codespicuous/commithistory.rb', line 54 def amount_of_comitters @committers.amount end |
#amount_of_commits_for_team_in_week(team_name, week) ⇒ Object
58 59 60 61 62 |
# File 'lib/codespicuous/commithistory.rb', line 58 def amount_of_commits_for_team_in_week(team_name, week) @commits.inject(0) { |amount_of_commits, commit| amount_of_commits + ((commit.by_team_with_name?(team_name) && commit.in_week?(week)) ? 1 : 0) } end |
#committer(name) ⇒ Object
38 39 40 |
# File 'lib/codespicuous/commithistory.rb', line 38 def committer(name) @committers.committer(name) end |
#configure(teams, repositories) ⇒ Object
14 15 16 17 18 |
# File 'lib/codespicuous/commithistory.rb', line 14 def configure(teams, repositories) @teams = teams @committers = teams.committers @repositories = repositories end |
#earliest_commit_date ⇒ Object
64 65 66 |
# File 'lib/codespicuous/commithistory.rb', line 64 def earliest_commit_date @commits.earliest_commit_date end |
#latest_commit_date ⇒ Object
68 69 70 |
# File 'lib/codespicuous/commithistory.rb', line 68 def latest_commit_date @commits.latest_commit_date end |
#repository(name) ⇒ Object
42 43 44 |
# File 'lib/codespicuous/commithistory.rb', line 42 def repository(name) @repositories.repository(name) end |
#repository_names ⇒ Object
50 51 52 |
# File 'lib/codespicuous/commithistory.rb', line 50 def repository_names @repositories.repository_names end |
#team(name) ⇒ Object
46 47 48 |
# File 'lib/codespicuous/commithistory.rb', line 46 def team(name) @teams.team(name) end |