1
0
Fork 0
mirror of https://github.com/capistrano/capistrano synced 2023-03-27 23:21:18 -04:00

One level of abstraction lower, please [DHH]

git-svn-id: http://svn.rubyonrails.org/rails/tools/capistrano@4163 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
David Heinemeier Hansson 2006-04-04 21:43:56 +00:00
parent 55e7c7f74d
commit 6dd4e4e273
2 changed files with 8 additions and 8 deletions

View file

@ -1,10 +1,10 @@
*SVN* *SVN*
* Added Actor#tail method that makes it easy to create cross-server tails [DHH]. Example: * Added Actor#stream method that makes it easy to create cross-server streams [DHH]. Example:
desc "Run a tail on multiple log files at the same time" desc "Run a tail on multiple log files at the same time"
task :tail_fcgi, :roles => :app do task :tail_fcgi, :roles => :app do
tail "#{shared_path}/log/fastcgi.crash.log" stream "tail -f #{shared_path}/log/fastcgi.crash.log"
end end
* Make update_code and symlink a macro task under the name "update" for easy of deploy to servers that does not run fcgis [DHH] * Make update_code and symlink a macro task under the name "update" for easy of deploy to servers that does not run fcgis [DHH]

View file

@ -212,19 +212,19 @@ module Capistrano
end end
end end
# Puts a tail on the file from all servers that are the target of the # Streams the result of the command from all servers that are the target of the
# current task. All the tails will be joined into a single coherent stream, # current task. All these streams will be joined into a single one,
# so you can watch 10 log files as though they were one. Do note that this # 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. # is quite expensive from a bandwidth perspective, so use it with care.
# #
# Example: # Example:
# #
# desc "Run a tail on multiple log files at the same time" # desc "Run a tail on multiple log files at the same time"
# task :tail_fcgi, :roles => :app do # task :tail_fcgi, :roles => :app do
# tail "#{shared_path}/log/fastcgi.crash.log" # stream "tail -f #{shared_path}/log/fastcgi.crash.log"
# end # end
def tail(file) def stream(command)
run "tail -f #{file}" do |ch, stream, out| run(command) do |ch, stream, out|
puts out if stream == :out puts out if stream == :out
if stream == :err if stream == :err
puts "[err : #{ch[:host]}] #{out}" puts "[err : #{ch[:host]}] #{out}"