From 6dd4e4e27391d4feed8c91291c459d7de1bb5c88 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Tue, 4 Apr 2006 21:43:56 +0000 Subject: [PATCH] One level of abstraction lower, please [DHH] git-svn-id: http://svn.rubyonrails.org/rails/tools/capistrano@4163 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- CHANGELOG | 4 ++-- lib/capistrano/actor.rb | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index f8177fed..42c56a6a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,10 +1,10 @@ *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" task :tail_fcgi, :roles => :app do - tail "#{shared_path}/log/fastcgi.crash.log" + stream "tail -f #{shared_path}/log/fastcgi.crash.log" 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] diff --git a/lib/capistrano/actor.rb b/lib/capistrano/actor.rb index fe671323..46dfb390 100644 --- a/lib/capistrano/actor.rb +++ b/lib/capistrano/actor.rb @@ -212,19 +212,19 @@ module Capistrano end end - # Puts a tail on the file from all servers that are the target of the - # current task. All the tails will be joined into a single coherent stream, - # so you can watch 10 log files as though they were one. Do note that this + # 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. # # Example: # # desc "Run a tail on multiple log files at the same time" # task :tail_fcgi, :roles => :app do - # tail "#{shared_path}/log/fastcgi.crash.log" + # stream "tail -f #{shared_path}/log/fastcgi.crash.log" # end - def tail(file) - run "tail -f #{file}" do |ch, stream, out| + def stream(command) + run(command) do |ch, stream, out| puts out if stream == :out if stream == :err puts "[err : #{ch[:host]}] #{out}"