Merge pull request #1081 from MrJoy/rsync_deployment_fixups

Various rsync deployment fixups:
This commit is contained in:
Parker Moore 2013-03-04 02:46:07 -08:00
commit dfe703b11d

View File

@ -334,6 +334,11 @@ desc "Generate website and deploy"
task :gen_deploy => [:integrate, :generate, :deploy] do
end
def ensure_trailing_slash(val)
val = "#{val}/" unless(val.end_with?('/'))
return val
end
desc "Deploy website via rsync"
task :rsync do
exclude = ""
@ -341,7 +346,13 @@ task :rsync do
exclude = "--exclude-from '#{File.expand_path('./rsync-exclude')}'"
end
puts "## Deploying website via Rsync"
ok_failed system("rsync -avze 'ssh -p #{configuration[:ssh_port]} #{'-i' + configuration[:ssh_key] unless configuration[:ssh_key].empty?}' #{exclude} #{configuration[:rsync_args]} #{"--delete" unless configuration[:rsync_delete] == false} #{configuration[:destination]}/ #{configuration[:ssh_user]}:#{configuration[:document_root]}")
ssh_key = if(!configuration[:ssh_key].nil? && !configuration[:ssh_key].empty?)
"-i #{ENV['HOME']}/.ssh/#{configuration[:ssh_key]}"
else
""
end
document_root = ensure_trailing_slash(configuration[:document_root])
ok_failed system("rsync -avze 'ssh -p #{configuration[:ssh_port]} #{ssh_key}' #{exclude} #{configuration[:rsync_args]} #{"--delete" unless !configuration[:rsync_delete]} #{ensure_trailing_slash(configuration[:destination])} #{configuration[:ssh_user]}:#{document_root}")
end
desc "deploy public directory to github pages"