Class: Commands::AddJobFlowStepsCommand

Inherits:
StepProcessingCommand show all
Defined in:
lib/commands.rb

Instance Attribute Summary

Attributes inherited from StepProcessingCommand

#step_commands

Attributes inherited from Command

#arg, #commands, #description, #logger, #name

Instance Method Summary collapse

Methods inherited from StepProcessingCommand

#initialize, #reorder_steps

Methods inherited from Command

#get_field, #has_value, #have, #initialize, #option, #require, #require_single_jobflow, #resolve

Constructor Details

This class inherits a constructor from Commands::StepProcessingCommand

Instance Method Details

#add_step_command(step) ⇒ Object



761
762
763
# File 'lib/commands.rb', line 761

def add_step_command(step)
  @step_commands << step
end

#enact(client) ⇒ Object



771
772
773
774
775
776
777
778
# File 'lib/commands.rb', line 771

def enact(client)
  jobflow_id = require_single_jobflow
  jobflow = client.describe_jobflow_with_id(jobflow_id)
  self.step_commands = reorder_steps(jobflow, self.step_commands)
  jobflow_steps = step_commands.map { |x| x.steps }.flatten
  client.add_steps(jobflow_id, jobflow_steps)
  logger.puts("Added jobflow steps")
end

#validateObject



765
766
767
768
769
# File 'lib/commands.rb', line 765

def validate
  for cmd in step_commands do
    cmd.validate
  end
end