diff --git a/tasks/maxcdn.js b/tasks/maxcdn.js index f45060e..c2f6074 100644 --- a/tasks/maxcdn.js +++ b/tasks/maxcdn.js @@ -4,18 +4,22 @@ module.exports = function (grunt) { grunt.registerMultiTask('maxcdn', 'Interact with the MaxCDN API', function () { + var done = this.async(); var options = this.options(); if (!this.files) { grunt.fail.fatal('files is mandatory'); + return done(); } if (!options.zone_id) { grunt.fail.fatal('options.zone_id is mandatory'); + return done(); } if (options.method !== 'delete') { grunt.fail.fatal('Sorry! Only delete method is supported.'); + return done(); } var files = []; @@ -35,14 +39,15 @@ module.exports = function (grunt) { maxcdn.delete( 'zones/pull.json/' + options.zone_id + '/cache', - { files: this.files }, + { files: files }, function (err, response) { if (err) { grunt.log.error(err); - return; + return done(); } console.log(response); + done(true); }); });