diff --git a/tasks/deploy/update.js b/tasks/deploy/update.js index edaa45a..02e1373 100644 --- a/tasks/deploy/update.js +++ b/tasks/deploy/update.js @@ -67,9 +67,11 @@ module.exports = function (gruntOrShipit) { function remoteCopy() { var uploadDirPath = path.resolve(shipit.config.workspace, shipit.config.dirToCopy || ''); + var options = _.get(shipit.config, 'deploy.remoteCopy') || {rsync: '--del'}; shipit.log('Copy project to remote servers.'); - return shipit.remoteCopy(uploadDirPath + '/', shipit.releasePath, {rsync: '--del'}) + + return shipit.remoteCopy(uploadDirPath + '/', shipit.releasePath, options) .then(function () { shipit.log(chalk.green('Finished copy.')); }); diff --git a/test/unit/tasks/deploy/update.js b/test/unit/tasks/deploy/update.js index e18a227..0cdea4c 100644 --- a/test/unit/tasks/deploy/update.js +++ b/test/unit/tasks/deploy/update.js @@ -110,6 +110,23 @@ describe('deploy:update task', function () { }) }); + describe('remoteCopy option', function () { + it('should accept rsync options', function () { + return new Promise(function (resolve, reject) { + var shipit = stubShipit(createShipitInstance({ + deploy: {remoteCopy: {rsync: '--foo'}} + })); + shipit.start('deploy:update', function (err) { + if (err) reject(err); + var dirName = moment.utc().format('YYYYMMDDHHmmss'); + expect(shipit.remoteCopy).to.be.calledWith('/tmp/workspace/', '/remote/deploy/releases/' + dirName, {rsync: '--foo'}); + clock.tick(5); + resolve() + }) + }); + }) + }); + }); describe('#setPreviousRevision', function () {