Skip to content
This repository has been archived by the owner on Mar 18, 2018. It is now read-only.

Commit

Permalink
add undefined avoidance, and update publish test
Browse files Browse the repository at this point in the history
  • Loading branch information
travco committed Aug 1, 2016
1 parent f47470e commit cd19ead
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions tasks/deploy/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -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')));
}
Expand Down
2 changes: 1 addition & 1 deletion test/unit/tasks/deploy/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
});
Expand Down

0 comments on commit cd19ead

Please sign in to comment.