Sha256: 5a7d110525d75eecd35fe6075a72bf781a4e96b777c794df030e7555091eafce

Contents?: true

Size: 1.23 KB

Versions: 5

Compression:

Stored size: 1.23 KB

Contents

namespace :log do
  namespace :tail do
    desc "Tail Rails production log file"
    task :production, :roles => :app do
      run "tail -f #{shared_path}/log/production.log" do |channel, stream, data|
        puts "\n#{channel[:host]}: #{data}"
        break if stream == :err
      end
    end
    desc "Tail Apache access log file"
    task :access, :roles => :app do
      run "tail -f #{shared_path}/log/access_log" do |channel, stream, data|
        puts "\n#{channel[:host]}: #{data}"
        break if stream == :err
      end
    end
  end

  namespace :pull do
    desc "Pull production log file to /tmp/production.log"
    task :production, :roles => :app do
      run "gzip -c #{shared_path}/log/production.log > #{shared_path}/log/production.log.gz"
      `rm -f /tmp/production.log.gz`
      puts "Downloading #{shared_path}/log/production.log...\n"
      download("#{shared_path}/log/production.log.gz", "/tmp/production.log.gz", :via => :scp)  do |channel, name, received, total|
        print "\r   #{name}: #{(Float(received)/total*100).to_i}% complete..."
      end
      run "rm -f #{shared_path}/log/production.log.gz"
      `gzip -fd /tmp/production.log.gz`
      puts "File can be accessed at /tmp/production.log"
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
crossroads_capistrano-1.3.61 lib/crossroads_capistrano/recipes/log.rb
crossroads_capistrano-1.3.60 lib/crossroads_capistrano/recipes/log.rb
crossroads_capistrano-1.3.4 lib/crossroads_capistrano/recipes/log.rb
crossroads_capistrano-1.3.3 lib/crossroads_capistrano/recipes/log.rb
crossroads_capistrano-1.3.2 lib/crossroads_capistrano/recipes/log.rb