Class: GitCompound::Manifest

Inherits:
Node
  • Object
show all
Defined in:
lib/git_compound/manifest.rb

Overview

Manifest

Constant Summary collapse

FILENAMES =
%w(Compoundfile .gitcompound)

Instance Attribute Summary collapse

Attributes inherited from Node

#parent

Instance Method Summary collapse

Methods inherited from Node

#ancestors

Constructor Details

#initialize(contents, parent = nil) ⇒ Manifest

Returns a new instance of Manifest.



11
12
13
14
15
16
17
18
19
# File 'lib/git_compound/manifest.rb', line 11

def initialize(contents, parent = nil)
  @contents   = contents
  @parent     = parent
  @name       = ''
  @maintainer = []
  @components = {}
  @tasks      = {}
  DSL::ManifestDSL.new(self, contents) if contents
end

Instance Attribute Details

#componentsObject

Returns the value of attribute components.



7
8
9
# File 'lib/git_compound/manifest.rb', line 7

def components
  @components
end

#maintainerObject

Returns the value of attribute maintainer.



7
8
9
# File 'lib/git_compound/manifest.rb', line 7

def maintainer
  @maintainer
end

#nameObject

Returns the value of attribute name.



7
8
9
# File 'lib/git_compound/manifest.rb', line 7

def name
  @name
end

#tasksObject

Returns the value of attribute tasks.



7
8
9
# File 'lib/git_compound/manifest.rb', line 7

def tasks
  @tasks
end

Instance Method Details

#==(other) ⇒ Object



27
28
29
30
# File 'lib/git_compound/manifest.rb', line 27

def ==(other)
  return false unless other.instance_of? Manifest
  md5sum == other.md5sum
end

#exists?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/git_compound/manifest.rb', line 32

def exists?
  @contents ? true : false
end

#md5sumObject



36
37
38
# File 'lib/git_compound/manifest.rb', line 36

def md5sum
  Digest::MD5.hexdigest(@contents) if exists?
end

#process(*workers) ⇒ Object



21
22
23
24
25
# File 'lib/git_compound/manifest.rb', line 21

def process(*workers)
  workers.each { |worker| worker.visit_manifest(self) }
  components.each_value { |component| component.process(*workers) }
  tasks.each_value { |task| workers.each { |worker| worker.visit_task(task) } }
end