Class: RepositoryLister
- Inherits:
-
Object
- Object
- RepositoryLister
- Defined in:
- lib/codespicuous/repository_lister.rb
Instance Method Summary collapse
- #collect_teams_and_repositories_they_committed_to(commit_history) ⇒ Object
- #list(commit_history) ⇒ Object
- #print_teams_commit_to_which_repository(teams_and_repositories) ⇒ Object
Instance Method Details
#collect_teams_and_repositories_they_committed_to(commit_history) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/codespicuous/repository_lister.rb', line 17 def collect_teams_and_repositories_they_committed_to(commit_history) teams_and_repositories = {} commit_history.teams.each do |team| repositories = team.committed_repositories teams_and_repositories[team.name] = repositories unless repositories.empty? end teams_and_repositories end |
#list(commit_history) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/codespicuous/repository_lister.rb', line 5 def list(commit_history) teams_and_repositories = collect_teams_and_repositories_they_committed_to(commit_history) if teams_and_repositories.empty? puts "No teams committed in any of the repositories" return end print_teams_commit_to_which_repository(teams_and_repositories) end |
#print_teams_commit_to_which_repository(teams_and_repositories) ⇒ Object
26 27 28 29 30 31 32 33 34 |
# File 'lib/codespicuous/repository_lister.rb', line 26 def print_teams_commit_to_which_repository(teams_and_repositories) teams_and_repositories.each do |team, repositories| repositories_string = "" repositories.each do |repository| repositories_string += " " + repository.name + "\n" end puts "Team \"#{team}\" committed in:\n" + repositories_string end end |