Module | Capistrano::Configuration::Actions::Inspect |
In: |
lib/capistrano/configuration/actions/inspect.rb
lib/capistrano/configuration/actions/inspect.rb |
Executes the given command on the first server targetted by the current task, collects it‘s stdout into a string, and returns the string. The command is invoked via invoke_command.
# File lib/capistrano/configuration/actions/inspect.rb, line 32 32: def capture(command, options={}) 33: output = "" 34: invoke_command(command, options.merge(:once => true)) do |ch, stream, data| 35: case stream 36: when :out then output << data 37: when :err then warn "[err :: #{ch[:server]}] #{data}" 38: end 39: end 40: output 41: end
Executes the given command on the first server targetted by the current task, collects it‘s stdout into a string, and returns the string. The command is invoked via invoke_command.
# File lib/capistrano/configuration/actions/inspect.rb, line 32 32: def capture(command, options={}) 33: output = "" 34: invoke_command(command, options.merge(:once => true)) do |ch, stream, data| 35: case stream 36: when :out then output << data 37: when :err then warn "[err :: #{ch[:server]}] #{data}" 38: end 39: end 40: output 41: end
Streams the result of the command from all servers that are the target of the current task. All these streams will be joined into a single one, so you can, say, watch 10 log files as though they were one. Do note that this is quite expensive from a bandwidth perspective, so use it with care.
The command is invoked via invoke_command.
Usage:
desc "Run a tail on multiple log files at the same time" task :tail_fcgi, :roles => :app do stream "tail -f #{shared_path}/log/fastcgi.crash.log" end
# File lib/capistrano/configuration/actions/inspect.rb, line 22 22: def stream(command, options={}) 23: invoke_command(command, options) do |ch, stream, out| 24: puts out if stream == :out 25: warn "[err :: #{ch[:server]}] #{out}" if stream == :err 26: end 27: end
Streams the result of the command from all servers that are the target of the current task. All these streams will be joined into a single one, so you can, say, watch 10 log files as though they were one. Do note that this is quite expensive from a bandwidth perspective, so use it with care.
The command is invoked via invoke_command.
Usage:
desc "Run a tail on multiple log files at the same time" task :tail_fcgi, :roles => :app do stream "tail -f #{shared_path}/log/fastcgi.crash.log" end
# File lib/capistrano/configuration/actions/inspect.rb, line 22 22: def stream(command, options={}) 23: invoke_command(command, options) do |ch, stream, out| 24: puts out if stream == :out 25: warn "[err :: #{ch[:server]}] #{out}" if stream == :err 26: end 27: end