lib/capissh/invocation.rb
def parallel(servers, options={})
      raise ArgumentError, "parallel() requires a block" unless block_given?
      tree = CommandTree.new(configuration, options) { |t| yield t }
      run_tree(servers, tree, options)
    end
# Executes different commands in parallel. This is useful for commands
# that need to be different on different hosts, but which could be
# otherwise run in parallel.
#
# The +options+ parameter is currently unused.
#
# Example:
#
#   parallel do |session|
#     session.when "in?(:app)", "/path/to/restart/mongrel"
#     session.when "in?(:web)", "/path/to/restart/apache"
#     session.when "in?(:db)", "/path/to/restart/mysql"
#   end
#
# Each command may have its own callback block, for capturing and
# responding to output, with semantics identical to #run:
#
#   session.when "in?(:app)", "/path/to/restart/mongrel" do |ch, stream, data|
#     # ch is the SSH channel for this command, used to send data
#     #    back to the command (e.g. ch.send_data("password\n"))
#     # stream is either :out or :err, for which stream the data arrived on
#     # data is a string containing data sent from the remote command
#   end
#
# Also, you can specify a fallback command, to use when none of the
# conditions match a server:
#
#   session.else "/execute/something/else"
#
# The string specified as the first argument to +when+ may be any valid
# Ruby code. It has access to the following variables and methods:
#
# * +server+ is the ServerDefinition object for the server. This can be
#   used to get the host-name, etc.
# * +configuration+ is the current Capissh::Configuration object, which
#   you can use to get the value of variables, etc.
#
# For example:
#
#   session.when "server.host =~ /app/", "/some/command"
#   session.when "server.host == configuration[:some_var]", "/another/command"
#   session.when "server.role?(:web) || server.role?(:app)", "/more/commands"
#
# See #run for a description of the valid +options+.
Executes different commands in parallel. This is useful for commands
that need to be different on different hosts, but which could be
otherwise run in parallel.

The +options+ parameter is currently unused.





Each command may have its own callback block, for capturing and
responding to output, with semantics identical to #run.

session.when "in?(:app)", "/path/to/restart/mongrel" do |ch, stream, data|
ch is the SSH channel for this command, used to send data
back to the command )
stream is either :out or :err, for which stream the data arrived on
data is a string containing data sent from the remote command
end

Also, you can specify a fallback command, to use when none of the
conditions match a server.



The string specified as the first argument to +when+ may be any valid
Ruby code. It has access to the following variables and methods.

+server+ is the ServerDefinition object for the server. This can be
used to get the host-name, etc.
+configuration+ is the current Capissh::Configuration object, which
you can use to get the value of variables, etc.

For example.



See #run for a description of the valid +options+.
Executes different commands in parallel . This is useful for commands that need to be different on different hosts but which could be otherwise run in parallel . The + options + parameter is currently unused . Each command may have its own callback block for capturing and responding to output with semantics identical to #run . session . when " in? ( : app ) " " / path / to / restart / mongrel " do |ch stream data| ch is the SSH channel for this command used to send data back to the command ) stream is either : out or : err for which stream the data arrived on data is a string containing data sent from the remote command end Also you can specify a fallback command to use when none of the conditions match a server . The string specified as the first argument to + when + may be any valid Ruby code . It has access to the following variables and methods . + server + is the ServerDefinition object for the server . This can be used to get the host - name etc . + configuration + is the current Capissh :: Configuration object which you can use to get the value of variables etc . For example . See #run for a description of the valid + options + .
def parallel(servers, options={})
      raise ArgumentError, "parallel() requires a block" unless block_given?
      tree = CommandTree.new(configuration, options) { |t| yield t }
      run_tree(servers, tree, options)
    end
def parallel ( servers , options = { } ) raise ArgumentError , "parallel() requires a block" unless block_given? tree = CommandTree . new ( configuration , options ) { | t | yield t } run_tree ( servers , tree , options ) end
Executes different commands in parallel.
Executes different commands in parallel .
servers
options