Class: TFSGraph::Project
Constant Summary
collapse
- SCHEMA =
{
name: {key: "Name"},
last_updated: {type: Time, default: Time.at(0).utc},
hidden: {default: false, type: String}
}
TFSGraph::PersistableEntity::NotPersisted
Instance Attribute Summary
#db_object, #id
Instance Method Summary
collapse
#delete!, #initialize, #persist, #persisted?, repository, #save!, #to_hash
Methods included from Extensions
#base_class_name
Methods inherited from Entity
inherited, #initialize, #schema, #to_hash
Instance Method Details
#<=>(other) ⇒ Object
13
14
15
|
# File 'lib/tfs_graph/project.rb', line 13
def <=>(other)
id <=> other.id
end
|
#active_branches ⇒ Object
57
58
59
|
# File 'lib/tfs_graph/project.rb', line 57
def active_branches
branches.reject(&:archived?)
end
|
#add_branch(branch) ⇒ Object
36
37
38
39
40
41
|
# File 'lib/tfs_graph/project.rb', line 36
def add_branch(branch)
branch.project = self.name
branch.save!
@repo.relate(:branches, db_object, branch.db_object)
end
|
#all_activity ⇒ Object
47
48
49
|
# File 'lib/tfs_graph/project.rb', line 47
def all_activity
@repo.activity(self)
end
|
#all_activity_by_date(limiter = nil) ⇒ Object
51
52
53
54
55
|
# File 'lib/tfs_graph/project.rb', line 51
def all_activity_by_date(limiter=nil)
raise InvalidArgument("parameter must be a Date") unless limiter.nil? || limiter.is_a?(Time)
@repo.activity_by_date(self, limiter).group_by(&:formatted_created)
end
|
#branches ⇒ Object
61
62
63
|
# File 'lib/tfs_graph/project.rb', line 61
def branches
branches_with_hidden.reject(&:hidden?)
end
|
#branches_for_root(root) ⇒ Object
65
66
67
|
# File 'lib/tfs_graph/project.rb', line 65
def branches_for_root(root)
@repo.branches_for_root(self, root)
end
|
#branches_with_hidden ⇒ Object
73
74
75
|
# File 'lib/tfs_graph/project.rb', line 73
def branches_with_hidden
@repo.get_nodes(db_object, :outgoing, :branches, Branch)
end
|
#changesets_for_root(root) ⇒ Object
69
70
71
|
# File 'lib/tfs_graph/project.rb', line 69
def changesets_for_root(root)
@repo.changesets_for_root(self, root)
end
|
#hidden ⇒ Object
28
29
30
|
# File 'lib/tfs_graph/project.rb', line 28
def hidden
@hidden.to_s
end
|
#hidden? ⇒ Boolean
32
33
34
|
# File 'lib/tfs_graph/project.rb', line 32
def hidden?
@hidden.to_s == "true"
end
|
#hide! ⇒ Object
22
23
24
25
|
# File 'lib/tfs_graph/project.rb', line 22
def hide!
self.hidden = true
save!
end
|
#root_branches ⇒ Object
43
44
45
|
# File 'lib/tfs_graph/project.rb', line 43
def root_branches
@repo.root_branches(self)
end
|
#updated! ⇒ Object
17
18
19
20
|
# File 'lib/tfs_graph/project.rb', line 17
def updated!
@last_updated = Time.now.utc
save!
end
|