Class: DesignShell::DeployPlan

Inherits:
Object
  • Object
show all
Defined in:
lib/designshell/deploy_plan.rb

Instance Method Summary collapse

Constructor Details

#initialize(aConfig = nil) ⇒ DeployPlan

Returns a new instance of DeployPlan.



3
4
5
6
7
# File 'lib/designshell/deploy_plan.rb', line 3

def initialize(aConfig=nil)
  return if !aConfig
  @core = aConfig[:core]
  read(aConfig[:plan]) if aConfig[:plan]
end

Instance Method Details

#deploy_items_values(aDeployNode = nil) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/designshell/deploy_plan.rb', line 25

def deploy_items_values(aDeployNode=nil)
  aDeployNode ||= deploy_node()
  result = {}
  aDeployNode.get_elements('item').each do |n|
    next unless name = XmlUtils.attr(n,'name')
    if text = n.text.to_nil # value in node
      result[name] = text
    elsif key_chain                   # value in keyChain
      key = XmlUtils.attr(n,'key') || name
      result[name] = key_chain[key]
    end
  end
  result
end

#deploy_nodeObject

later accept criteria



17
18
19
# File 'lib/designshell/deploy_plan.rb', line 17

def deploy_node()  # later accept criteria
  XmlUtils.single_node(@deployPlanNode,'/deployPlan/plan/deploy')
end

#key_chainObject



21
22
23
# File 'lib/designshell/deploy_plan.rb', line 21

def key_chain
  @core && @core.context && @core.context.key_chain
end

#read(aDeployPlan) ⇒ Object



9
10
11
# File 'lib/designshell/deploy_plan.rb', line 9

def read(aDeployPlan)
  @deployPlanNode = XmlUtils.get_xml_root(aDeployPlan)
end

#siteObject



13
14
15
# File 'lib/designshell/deploy_plan.rb', line 13

def site
  XmlUtils.peek_node_value(@deployPlanNode,'/deployPlan/@site')
end