class Patriot::Command::CommandGroup
define a group of jobs
Attributes
subcommands[RW]
Public Class Methods
new(config)
click to toggle source
@see Patriot::Command::Base#initialize
Calls superclass method
Patriot::Command::Base::new
# File lib/patriot/command/command_group.rb, line 10 def initialize(config) super @subcommands = [] end
Public Instance Methods
add_subcommand(cmd)
click to toggle source
add a command to this group @param cmd [Patriot::Command::Base] a command to be added to this group
# File lib/patriot/command/command_group.rb, line 17 def add_subcommand(cmd) @subcommands << cmd end
configure()
click to toggle source
configure thie group. pass the required/produced products and parameters to the commands in this group @see Patriot::Command::Base#configure
@return [Array<Patriot::Command::Base>] a list of commands in this group
# File lib/patriot/command/command_group.rb, line 25 def configure return @subcommands.map{|cmd| cmd.require @requisites cmd.produce @products cmd.post_processors = @post_processors + (cmd.post_processors || []) unless @post_processors.nil? cmd.build(@param) }.flatten end
execute()
click to toggle source
execute each command in this group @see Patriot::Command::Base#execute
# File lib/patriot/command/command_group.rb, line 36 def execute @subcommands.each do |k,v| v.execute end end