Class: TFSGraph::Populators::ForProject

Inherits:
Object
  • Object
show all
Includes:
Utilities
Defined in:
lib/tfs_graph/populators/for_project.rb

Overview

incremental updates for a project, its branches, changesets and merges

Constant Summary

Constants included from StoreHelpers

StoreHelpers::UPDATED_KEY

Instance Method Summary collapse

Methods included from Utilities

#clean, #finalize, #find_branch, #find_project

Methods included from StoreHelpers

#flush_all, #last_updated_on, #mark_as_updated

Constructor Details

#initialize(project, since = Time.at(0).utc) ⇒ ForProject

Returns a new instance of ForProject.



10
11
12
13
# File 'lib/tfs_graph/populators/for_project.rb', line 10

def initialize(project, since=Time.at(0).utc)
  @project = project
  @branch_store = BranchStore.new(@project)
end

Instance Method Details

#populateObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/tfs_graph/populators/for_project.rb', line 15

def populate
  new_branches = @branch_store.fetch_since_last_update
  @branch_store.cache_all(new_branches)

  active_branches = @project.active_branches

  changesets = active_branches.map do |branch|
    ForBranch.new(@project, branch).populate
    branch.changesets
  end

  # Add merges
  active_branches.each {|branch| ChangesetMergeStore.new(branch).fetch_and_cache }
  ChangesetTreeBuilder.set_branch_merges(changesets.flatten)

  BranchArchiveHandler.hide_moved_archives_for_project(@project)
  @project.updated!
end