lib/capissh/invocation.rb
def run_tree(servers, tree, options={})
      if tree.branches.empty? && tree.fallback
        logger.debug "executing #{tree.fallback}" unless options[:silent]
      elsif tree.branches.any?
        logger.debug "executing multiple commands in parallel"
        tree.each do |branch|
          logger.trace "-> #{branch}"
        end
      else
        raise ArgumentError, "attempt to execute without specifying a command"
      end

      options = add_default_command_options(options)

      tree.each do |branch|
        if branch.command.include?(sudo_command)
          branch.callback = sudo_behavior_callback(branch.callback)
        end
      end

      command = Command.new(tree, options.merge(:logger => logger))

      configuration.execute_on_servers(servers, options) do |sessions|
        command.call(sessions)
      end
    end
# Executes a Capissh::CommandTree object. This is not for direct
# use, but should instead be called indirectly, via #run or #parallel,
# or #invoke_command.
Executes a Capissh::CommandTree object. This is not for direct
use, but should instead be called indirectly, via #run or #parallel,
or #invoke_command.
Executes a Capissh :: CommandTree object . This is not for direct use but should instead be called indirectly via #run or #parallel or #invoke_command .
def run_tree(servers, tree, options={})
      if tree.branches.empty? && tree.fallback
        logger.debug "executing #{tree.fallback}" unless options[:silent]
      elsif tree.branches.any?
        logger.debug "executing multiple commands in parallel"
        tree.each do |branch|
          logger.trace "-> #{branch}"
        end
      else
        raise ArgumentError, "attempt to execute without specifying a command"
      end
      options = add_default_command_options(options)
      tree.each do |branch|
        if branch.command.include?(sudo_command)
          branch.callback = sudo_behavior_callback(branch.callback)
        end
      end
      command = Command.new(tree, options.merge(:logger => logger))
      configuration.execute_on_servers(servers, options) do |sessions|
        command.call(sessions)
      end
    end
def run_tree ( servers , tree , options = { } ) if tree . branches . empty? && tree . fallback logger . debug "executing #{tree.fallback}" unless options [ :silent ] elsif tree . branches . any? logger . debug "executing multiple commands in parallel" tree . each do | branch | logger . trace "-> #{branch}" end else raise ArgumentError , "attempt to execute without specifying a command" end options = add_default_command_options ( options ) tree . each do | branch | if branch . command . include? ( sudo_command ) branch . callback = sudo_behavior_callback ( branch . callback ) end end command = Command . new ( tree , options . merge ( :logger => logger ) ) configuration . execute_on_servers ( servers , options ) do | sessions | command . call ( sessions ) end end
Executes a Capissh::CommandTree object.
Executes a Capissh :: CommandTree object .
servers
tree
options