Rsync --delete option can be turned off in Rakefile configuration and users can exclude directories from sync by adding an rsync-exclude file to their root directory. fixes #247

This commit is contained in:
Brandon Mathis 2011-12-10 18:18:34 -06:00
parent 692c8f3491
commit bdc3cb8bd3

View File

@ -7,6 +7,7 @@ require "stringex"
ssh_user = "user@domain.com"
ssh_port = "22"
document_root = "~/website.com/"
rsync_delete = true
deploy_default = "rsync"
# This will be configured for you when you run config_deploy
@ -231,8 +232,12 @@ end
desc "Deploy website via rsync"
task :rsync do
exclude = ""
if File.exists?('./rsync-exclude'))
exclude = "--exclude-from '#{File.expand_path('./rsync-exclude')}'"
end
puts "## Deploying website via Rsync"
ok_failed system("rsync -avze 'ssh -p #{ssh_port}' --delete #{public_dir}/ #{ssh_user}:#{document_root}")
ok_failed system("rsync -avze 'ssh -p #{ssh_port}' #{exclude} #{"--delete" unless rsync_delete == false} #{public_dir}/ #{ssh_user}:#{document_root}")
end
desc "deploy public directory to github pages"