var mkdirp = require('mkdirp');
var fs     = require('fs');
var utils  = require('amd-utils');
var async  = require('async');

var task = {
    'id'      : 'mkdir',
    'author'  : 'Indigo United',
    'name'    : 'Make dir recursively',
    'options' : {
        'dir': {
            'description': 'The directory you want to create'
        },
        'mode': {
            'description': 'The directory permissions',
            'default': '0777'

        }
    },
    'filter': function (opt) {
        if (!utils.lang.isNumber(opt.mode)) {
            opt.mode = parseInt(opt.mode, 8);
        }
    },
    'tasks' :
    [
        {
            'task' : function (opt, next) {

                if (utils.lang.isString(opt.dir)) {
                    opt.dir = [opt.dir];
                }
                var tasks = [];

                for (var i = 0, l = opt.dir.length; i < l; ++i) {
                    tasks.push(function (i) {
                        fs.stat(opt.dir[i], function (err, stat) {
                            if (!err || err.code !== 'ENOENT') {
                                if (stat && !stat.isDirectory()) {
                                    next(new Error('Passed dir already exists and is not a directory.'));
                                } else {
                                    next(err);
                                }
                            }

                            mkdirp(opt.dir[i], opt.mode, function (err) {
                                if (err) {
                                    next(err);
                                }
                                else {
                                    next();
                                }
                            });
                        });
                    }.bind(this, i));
                }
                async.parallel(tasks, next);
            },
            description: 'Make dir'
            /*
            description: function (opt) {
                return 'Making dirs: ' opt.dir.join(',');
            }*/

        }
    ]
};

module.exports = task;
@@ -675,17 +675,16 @@
 next) %7B%0A
-%0A
         
@@ -691,20 +691,26 @@
         
-if (
+var dir = 
 utils.la
@@ -718,14 +718,13 @@
 g.is
-String
+Array
 (opt
@@ -728,39 +728,18 @@
 opt.dir)
-) %7B%0A                  
  
+?
  opt.dir
@@ -739,17 +739,17 @@
 opt.dir 
-=
+:
  %5Bopt.di
@@ -756,175 +756,67 @@
 r%5D;%0A
-                %7D%0A                var tasks = %5B%5D;%0A%0A                for (var i = 0, l = opt.dir.length; i %3C l; ++i) %7B%0A                    tasks.push(function (i) %7B%0A    
+%0A                async.forEach(dir, function (dir, next) %7B%0A
     
@@ -839,26 +839,19 @@
 fs.stat(
-opt.dir%5Bi%5D
+dir
 , functi
@@ -863,28 +863,24 @@
 rr, stat) %7B%0A
-    
             
@@ -952,28 +952,24 @@
             
-    
 if (stat && 
@@ -987,28 +987,24 @@
 ectory()) %7B%0A
-    
             
@@ -1121,20 +1121,16 @@
         
-    
 %7D else %7B
@@ -1122,36 +1122,32 @@
        %7D else %7B%0A
-    
                 
@@ -1197,34 +1197,26 @@
             
-    %7D%0A    
+%7D%0A
             
@@ -1258,29 +1258,18 @@
     
-  
-  
 mkdirp(
-opt.dir%5Bi%5D
+dir
 , op
@@ -1280,418 +1280,56 @@
 de, 
-function (err) %7B%0A                                if (err) %7B%0A                                    next(err);%0A                                %7D%0A                                else %7B%0A                                    next();%0A                                %7D%0A                            %7D);%0A                        %7D);%0A                    %7D.bind(this, i));%0A                %7D%0A                async.parallel(tasks
+next);%0A                    %7D);%0A                %7D
 , ne

Fix mkdir task.