diff --git a/tasks/deploy/publish.js b/tasks/deploy/publish.js index db1feb5..50ce09c 100644 --- a/tasks/deploy/publish.js +++ b/tasks/deploy/publish.js @@ -35,10 +35,10 @@ module.exports = function (gruntOrShipit) { 'echo \"ERR: could not make symlink\"; ' + 'fi' ) - .then(function (result) { - var failedresult = result.filter(function(r) { - return r.stdout.indexOf('could not make symlink') > -1; - }); + .then(function (res) { + var failedresult = res ? res.stdout.filter(function(r) { + return r.indexOf('could not make symlink') > -1; + }) : []; if(failedresult.length && failedresult.length > 0) { shipit.log(chalk.yellow('Symbolic link at remote not made, as something already exists at ' + path(shipit.config.deployTo, 'current'))); } diff --git a/test/unit/tasks/deploy/publish.js b/test/unit/tasks/deploy/publish.js index c2d76e8..e516727 100644 --- a/test/unit/tasks/deploy/publish.js +++ b/test/unit/tasks/deploy/publish.js @@ -39,7 +39,7 @@ describe('deploy:publish task', function () { shipit.start('deploy:publish', function (err) { if (err) return done(err); expect(shipit.currentPath).to.equal('/remote/deploy/current'); - expect(shipit.remote).to.be.calledWith('cd /remote/deploy && ln -nfs releases/20141704123138 current'); + expect(shipit.remote).to.be.calledWith('cd /remote/deploy && if [[ -d current && ! (-L current) ]]; then ln -nfs releases/20141704123138 current;else echo "ERR: could not make symlink"; fi'); done(); }); });