class Dopi::StepSet
Public Class Methods
new(parsed_step_set, plan)
click to toggle source
# File lib/dopi/step_set.rb, line 11 def initialize(parsed_step_set, plan) @parsed_step_set = parsed_step_set @plan = plan steps.each{|step| state_add_child(step)} end
Public Instance Methods
load_state(state_hash)
click to toggle source
# File lib/dopi/step_set.rb, line 56 def load_state(state_hash) return if state_hash.empty? steps.each_with_index do |step, i| step.load_state(state_hash[i]) end end
name()
click to toggle source
# File lib/dopi/step_set.rb, line 17 def name @parsed_step_set.name end
run(run_options)
click to toggle source
# File lib/dopi/step_set.rb, line 21 def run(run_options) if state_done? Dopi.log.info("Step set #{name} is in state 'done'. Nothing to do") return end unless state_ready? raise StandardError, "Step set #{name} is not in state 'ready'. Try to reset the plan" end steps.each do |step| step.run(run_options) break if signals[:stop] || state_failed? end end
state_hash()
click to toggle source
# File lib/dopi/step_set.rb, line 63 def state_hash steps.map do |step| step.state_hash end end
steps()
click to toggle source
# File lib/dopi/step_set.rb, line 45 def steps # Before all the new commands get parsed we have to make sure we # Reset all the plugin defaults PluginManager.plugin_klass_list('^dopi/command/').each do |plugin_klass| plugin_klass.wipe_plugin_defaults end @steps ||= @parsed_step_set.steps.map do |parsed_step| ::Dopi::Step.new(parsed_step, @plan) end end
valid?()
click to toggle source
The main validation work is done in the dop_common parser. We just add the command plugin parsers
# File lib/dopi/step_set.rb, line 37 def valid? validity = true validity = false unless steps.all?{|step| step.valid? } validity rescue Dopi::NoRoleFoundError => e Dopi.log.warn(e.message) end