changes to asset auto_deploy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
desc <<-DESC | |
Deploy the system directory to production | |
DESC | |
task :fs, :roles => :web, :once => true do | |
servers = find_servers_for_task(current_task) | |
puts "SERVERSSSSSSS......>>>>>>>> #{servers}" | |
servers.each do |server| | |
port = 22 | |
Array(fetch(:sync_directories, [])).each do |syncdir| | |
destination, base = Pathname.new(syncdir).split | |
if File.directory? "#{syncdir}" | |
# Make a backup | |
logger.info "backup #{syncdir}" | |
run "tar cjf #{shared_path}/sync/#{base}.#{Time.now.strftime '%Y-%m-%d_%H:%M:%S'}.tar.bz2 #{current_path}/#{syncdir}" | |
purge_old_backups "#{base}" | |
else | |
logger.info "Create '#{syncdir}' directory" | |
run "mkdir #{current_path}/#{syncdir}" | |
end | |
# Sync directory up | |
logger.info "sync #{syncdir} to #{server}:#{port} from local" | |
system "rsync --verbose --archive --compress --keep-dirlinks --delete --stats --rsh='ssh -p #{port}' #{syncdir}/* #{user}@#{server}:#{current_path}/#{syncdir}/" | |
end | |
logger.important "sync file system from local to the stage '#{stage}' finished" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment