Class: CommitHistoryBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/codespicuous/commithistory_builder.rb

Instance Method Summary collapse

Constructor Details

#initializeCommitHistoryBuilder

Returns a new instance of CommitHistoryBuilder.



4
5
6
# File 'lib/codespicuous/commithistory_builder.rb', line 4

def initialize
  @commit_history = CommitHistory.new
end

Instance Method Details

#add_commit_to_historyObject



40
41
42
43
44
45
46
47
# File 'lib/codespicuous/commithistory_builder.rb', line 40

def add_commit_to_history
  commit = Commit.new
  commit.author = @author
  commit.date = DateTime.parse(@commit_date)
  commit.repository = @current_repository
  @commit_history.add_commit(commit)
  @commit_history.add_team_member(@team, @author)
end

#at(date) ⇒ Object



27
28
29
30
31
# File 'lib/codespicuous/commithistory_builder.rb', line 27

def at(date)
  @commit_date = date
  add_commit_to_history
  self
end

#buildObject



8
9
10
# File 'lib/codespicuous/commithistory_builder.rb', line 8

def build
  @commit_history
end

#commits_of(name) ⇒ Object



17
18
19
20
# File 'lib/codespicuous/commithistory_builder.rb', line 17

def commits_of(name)
  @author = name
  self
end

#in_repository(name) ⇒ Object



12
13
14
15
# File 'lib/codespicuous/commithistory_builder.rb', line 12

def in_repository(name)
  @current_repository = Repository.new(name, "")
  self
end

#of_team(name) ⇒ Object



22
23
24
25
# File 'lib/codespicuous/commithistory_builder.rb', line 22

def of_team(name)
  @team = name
  self
end

#times(number) ⇒ Object



33
34
35
36
37
38
# File 'lib/codespicuous/commithistory_builder.rb', line 33

def times(number)
  (number-1).times {
    add_commit_to_history
  }
  self
end