Sha256: 99efed2a61e5d71e67dba6072c4b8534cd30ff1f66688c936fb4f738da9b912c
Contents?: true
Size: 1.61 KB
Versions: 16
Compression:
Stored size: 1.61 KB
Contents
require 'capistrano/errors' module Capistrano class Configuration module Actions module Inspect # 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 def stream(command, options={}) invoke_command(command, options.merge(:eof => !command.include?(sudo))) do |ch, stream, out| puts out if stream == :out warn "[err :: #{ch[:server]}] #{out}" if stream == :err end 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. def capture(command, options={}) output = "" invoke_command(command, options.merge(:once => true, :eof => !command.include?(sudo))) do |ch, stream, data| case stream when :out then output << data when :err then warn "[err :: #{ch[:server]}] #{data}" end end output end end end end end
Version data entries
16 entries across 16 versions & 2 rubygems