class Patriot::Command::CompositeCommand
a command which is composed of multiple sub commands
Public Instance Methods
configure()
click to toggle source
configure this composite command. pull up required/produced products from the sub commands @see Patriot::Command::Base#configure
# File lib/patriot/command/composite.rb, line 26 def configure @name_suffix ||= _date_ # don't do flatten to handle nested composite commands @subcommands.map do |cmd| cmd = cmd.clone cmd.build(@param).each do |cmd| _validate_command(cmd) require cmd['requisites'] produce cmd['products'] @contained_commands << cmd end end return self end
description()
click to toggle source
@see Patriot::Command::Base#description
# File lib/patriot/command/composite.rb, line 17 def description first_job = @contained_commands.first first_job = first_job.description unless first_job.nil? return "#{first_job} ... (#{@contained_commands.size} jobs)" end
execute()
click to toggle source
execute the contained commands @see Patriot::Command::Base#execute
# File lib/patriot/command/composite.rb, line 43 def execute @contained_commands.each do |c| c.execute end end
job_id()
click to toggle source
@return [String] the identifier of this composite command @see Patriot::Command::Base#job_id
# File lib/patriot/command/composite.rb, line 12 def job_id return "#{command_name}_#{@name}_#{@name_suffix}" end
Private Instance Methods
_validate_command(cmd)
click to toggle source
@private validate command @param [Patriot::Command::Base] cmd
# File lib/patriot/command/composite.rb, line 52 def _validate_command(cmd) if !cmd['post_processors'].nil? raise 'you cannot set "post_processor" at subcommand of composite_job\'s ' \ + "\n" + 'name: ' + cmd['name'] \ + "\n" + 'command: ' + cmd['commands'].to_s end end