drone/drone — pull request #706 by fudanchii (2014-11-16 13:19:47+00:00)
Title: Refactor ssh deployment to use rsync

And support multiple commands to run on the target server.

Fixes #689 and #690

As discussed at #689, use rsync instead of scp for deploying artifacts.
Drone will first create a temp file for listing the artifacts and then use rsync's `--files-from` option for the transfer, to enable deploying multiple artifacts (possibly under different directories) at once.

To support running multiple command on the target host, drone first create a script file on the target host (named `/tmp/drone_deploy`), and running it as `sh` script.

To specify multiple artifacts and/or multiple commands, write them as multi-line string literals (not as list) indicated by pipe character("|"):
``` yml
ssh:
target: app@example.com:/srv/.app/myapp 2222
artifacts: ./
cmd: |
# commands will run under /srv/.app/myapp
bundle intall --deployment
bundle exec rake assets:clobber
RAKE_ENV=production bundle exec rake assets:precompile
sv -w 240 restart puma
```

yml ref: http://yaml.org/spec/1.2/spec.html#id2760844