Go back to the main page

Only display pending files for a capistrano deployment

This article is over 5 years old. Proceed with caution.

Regards ♨ ‐ Minimul


Built in Capistrano task cap deploy:pending:diff is too verbose. Here is a custom task called cap deploy:pending:files that just displays a list of pending files for the next deploy.

namespace :deploy do

  namespace :pending do
    desc "changed files for pending deployment"
    task :files, :except => { :no_release => true } do
      output = `#{source.local.diff(current_revision)} | egrep '^diff --git'`
      puts "=========================="
      puts "=====Changed Files========"
      puts "=========================="
      puts output.gsub(/diff --git a\//, '      ').gsub(/\sb\/.*$/,'')