From 0aba5d55ca3817105cfff8262946e8a0a94393f3 Mon Sep 17 00:00:00 2001 From: siacomuzzi Date: Thu, 20 Feb 2014 17:48:35 -0300 Subject: [PATCH] async task --- tasks/maxcdn.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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); }); });