lib/capistrano/sync.rb
#
# Purge old backups within the shared sync directory
#
Purge old backups within the shared sync directory
Purge old backups within the shared sync directory
def purge_old_backups(base)
    count = fetch(:sync_backups, 5).to_i
    backup_files = capture("ls -xt #{shared_path}/sync/#{base}*").split.reverse
    if count >= backup_files.length
      logger.important "no old backups to clean up"
    else
      logger.info "keeping #{count} of #{backup_files.length} sync backups"
      delete_backups = (backup_files - backup_files.last(count)).join(" ")
      run "rm #{delete_backups}"
    end
  end
def purge_old_backups ( base ) count = fetch ( :sync_backups , 5 ) . to_i backup_files = capture ( "ls -xt #{shared_path}/sync/#{base}*" ) . split . reverse if count >= backup_files . length logger . important "no old backups to clean up" else logger . info "keeping #{count} of #{backup_files.length} sync backups" delete_backups = ( backup_files - backup_files . last ( count ) ) . join ( " " ) run "rm #{delete_backups}" end end
Purge old backups within the shared sync directory
Purge old backups within the shared sync directory
base
<not_specific>