Create gulp's default task that runs every tasks
passed as arguments.

@params array of strings
@returns {bucket}
765653
function main () {
  var taskList = _(arguments).toArray().flatten(true).value()
  gulp.task('default', taskList)
  return this
}
692066
function loadTask(fileName, taskName) {
  const taskModule = require('./tools/gulp-tasks/' + fileName);
  const task = taskName ? taskModule[taskName] : taskModule;
  return task(gulp);
}
157920
function defineTaskGroups() {
  const gulpTasks = gulp.tree({ deep: false }).nodes
  const gulpMode = options.parallel ? gulp.parallel : gulp.series
  const groups = Object.keys(options.groups).map(key => [
    key.trim().replace(/[^a-z]+/gi, ''),
    options.groups[key]
  ])

  groups.forEach(group => {
    const [name, value] = group
    let children = []

    if (Array.isArray(value)) {
      children = value
    } else if (typeof value === 'function') {
      children = gulpTasks
        .filter(value)
        // Group tasks should not call themselves/other groups
        .filter(child => !groups.includes(child))
    } else {
      return
    }

    if (children.length === 0) {
      gulp.task(name, done => {
        handleError(new Error(`No tasks found in '${name}' group`))
        done()
      })
    } else {
      gulp.task(name, gulpMode.apply(null, children))
    }
  })
}
1339483
function chain(tasks) {
      return function() {
        var pipeline = fullPipeline();

        _.each(tasks, function(task) {
          pipeline = pipeline.pipe(task.callback(options)());
        });

        return pipeline;
      };
    }
954741
function gulpYarn(gulpYarnOptions) {
    var toRun = [];
    var count = 0;

    // Creating a stream through which each file will pass
    return through.obj(function (file, enc, callback) {
        if (file === undefined || file.isNull()) {
            // return empty file
            return callback(null, file);
        }

        // flush function
        var flush = function flush(err, file) {
            if (err) {
                return callback(err);
            }
            return callback(null, file);
        };
        var command = clone(commandList[path.basename(file.path)]);
        if (command !== undefined) {
            if (gulpYarnOptions) {
                var error = undefined;
                command.args = Object.keys(gulpYarnOptions).map(function (key) {
                    if (yarnArgs.hasOwnProperty(key) && gulpYarnOptions[key] === true) {
                        return yarnArgs[key];
                    } else {
                        if (key !== 'args') {
                            error = new PluginError(PLUGIN_NAME, `Command '${key}' not supported.`);
                        }
                    }
                }).filter(function (item) {
                    return item !== undefined || item === null;
                });

                if (error) {
                    return flush(error);
                }
            }
            if (gulpYarnOptions && gulpYarnOptions.args) {
                command.args = flatten(command.args.concat(formatArguments(gulpYarnOptions.args)));
            }
            command.cwd = path.dirname(file.path);
            toRun.push(command);

            if (!toRun.length) {
                callback(new PluginError(PLUGIN_NAME, `No commands found to run.`));
            }

            return mapSeries(toRun, function (singleCommand, next) {
                which(singleCommand.cmd, function (err, cmdpath) {
                    if (err) {
                        next(new PluginError(PLUGIN_NAME, `Error while determining the folder path.`));
                    }
                    var installOptions = {
                        stdio: 'inherit',
                        shell: true,
                        cwd: singleCommand.cwd || process.cwd()
                    };
                    var cmd = childProcess.spawn(`"${cmdpath}"`, singleCommand.args, installOptions);
                    cmd.once('close', function (code) {
                        if (code !== 0) {
                            next(new PluginError(PLUGIN_NAME, `${command.cmd} exited with non-zero code ${code}.`));
                        } else {
                            // If all commands are finished
                            if (toRun.length === ++count) {
                                next(false, file);
                            }
                        }
                    });
                });
            }, function (err, file) {
                if (err) {
                    flush(err);
                }
                flush(null, file[0]);
            });
        } else {
            callback();
        }
    });
}
1053806
function Tasks(tasks, cwd){
  this.num = 0;
  this.finish = 0;
  var _this = this;
  this.setMaxListeners(50);
  
  forEach(tasks, function(task){
    var exec = require('./' + task.task);
    forEach(task.files, function(file){
      var cmd = new exec({'file': file, cwd: cwd});
      //console.log('[task ' + task.task + '] on file ' + file + ' begin');
      this.num = this.num + 1;
      cmd.on('finish', function(e){
        _this.emit('finish', {ret: e, file: file, task: task.task});
      });
    }, this);
  }, this);
  this._bind();
}
388128
function moduleWatchTask(taskname, fn) {
    var module = this;
    var fulltaskname = module.name + '-' + taskname + '-watch';

    module.task(taskname + '-watch', null, function(cb) {

      var w = fn();

      if(!w) {
        throw new Error('No options returned from watch: ' + taskname);
      }

      if(!w.glob) {
        throw new Error('No glob watch property in options: ' + taskname);
      }

      w.tasks = w.tasks || [taskname];

      var i = w.tasks.length;

      while(i--) {
        w.tasks[i] = module.name + '-' + w.tasks[i];
      }

      var watcher =  gulp.watch(w.glob, w.tasks);

      function onEvent(event) {
        console.log(event);
      }

      watcher.on('change', function(event) {
        console.log('File ' + event.path + ' was ' + event.type + ', running tasks...');
        var exec = require('child_process').exec;

        exec('growlnotify --image gulp-tasks/run.png -n angular-project-template -m "' + module.name + '-' + taskname + ': build triggered."')
      });

      cb();
    }, true);

    module.watchTasks.push(fulltaskname);
  }
303436
function _createFileTask(gulp, name, config, depTasks, index, startFun, endFun) {
    gulp.task(name, depTasks, function(){
        var s = config.files[index];
       return runFileTaskStream(gulp, s, config, startFun, endFun);
    });
}
448541
function() {
    // A stack, latest task is the last item in the array
    this.tasks = [];
    this.currentLine = 0;

    // Keeping track of current line in the log
    // Shadow stdout.write and stderr.write
    newlines(process.stdout);
    newlines(process.stderr);
    process.stderr.on('newline', function() {
        this.currentLine++;
    }.bind(this));
    process.stdout.on('newline', function() {
        this.currentLine++;
    }.bind(this));

    // Functions to expose
    this.log = function() {
        // Similar to console.log, but nested appropriately
        const args = [].slice.call(arguments);
        log(console.log, args, this.tasks.length);
    };

    this.error = function() {
        // Similar to console.error, but nested appropriately
        const args = [].slice.call(arguments);
        log(console.error, args, this.tasks.length);
    };

    /**
     *  Task tracking, acts almost like a wrapper around Promise(func(resolve, reject))
     *  If the passed in function takes no arguments, then it is assumed to be a sync
     *  call that may throw (reject) or return a value (resolve)
     *
     *  @returns Promise that resolves/rejects as if the contents, but adds some
     *  logging logic around it
     */
    this.task = function(taskName, taskFunction) {
        const indentation = this.tasks.length;
        const lines = indentation === 0 ? 1 : 0;

        // Push a simple task object to the queue
        const task = {
            name: taskName,
            line: this.currentLine + lines,
            indentation: indentation
        };

        const introLine = `${_.repeat('\t', indentation)}${taskName}`;

        const finish = function(t, succeed, err) {
            const idx = _.findIndex(this.tasks, t);
            if (idx === -1) {
                throw new Error('Task is not part of the logger');
            }

            // Remove from tasks
            this.tasks.splice(idx, 1);

            // Create message to write, then decide where to write
            let message;
            if (succeed) {
                message = `${introLine} ${chalk.green('✔')}`;
            } else if (err) {
                message = `${introLine} ${chalk.red('✖')} ${err.message}`;
            } else {
                message = `${introLine} ${chalk.red('✖')}`;
            }

            // Simple check, if on next line of the task, append to previous line
            // otherwise add a new line
            if (this.currentLine === task.line + 1) {
                cursor.up(1).eraseLine().write(message).down(1).horizontalAbsolute(0);
            } else {
                cursor.write(message).write('\n\n');
            }
        }.bind(this);

        return new Promise(function(resolve, reject) {
            // If there are currently no tasks, add an empty line
            // (top-level or first tasks are separated by empty lines)
            if (this.tasks.length === 0) {
                cursor.write('\n');
            }

            // Print out the task name
            cursor.write(`${introLine}\n`);

            // Add to the tasks array
            this.tasks.push(task);

            if (taskFunction.length === 0) {
                // Sync task
                try {
                    const result = taskFunction();
                    finish(task, true, null);
                    resolve(result);
                } catch (err) {
                    finish(task, false, err);
                    reject(err);
                }
            } else {
                // Async task
                const res = function(value) {
                    finish(task, true, null);
                    resolve(value);
                };

                const rej = function(err) {
                    finish(task, false, err);
                    reject(err);
                };

                taskFunction(res, rej);
            }
        }.bind(this));
    };

    return this;
}
129807
function importTasks(options) {
  const opts = parseOptions(options);
  const cwd = process.cwd();
  const dir = path.join(cwd, opts.dir);

  debug(`importing tasks from "${dir}"...`);

  // This synchronously reads the contents within the chosen directory then
  // loops through each item, verifies that it is in fact a file of the correct
  // file type, then creates the tasks object and registers it with gulp.
  fs.readdirSync(dir).forEach(
    handleFile(dir, opts)
  );

  debug(`finished importing tasks`);
}
57929
function moduleTask(taskname, depsOrFn, fn, noAutoRegister) {

    var module = this;

    if (typeof(depsOrFn) == 'string') {
      depsOrFn = [depsOrFn];
    }

    if (Array.isArray(depsOrFn)) {

      var map = [];

      depsOrFn.forEach(function (dep) {
        map.push(module.name + '-' + dep);
      });

      depsOrFn = map;

    }

    var fulltaskname = module.name + '-' + taskname;
    gulp.task(fulltaskname, depsOrFn, fn);

    if(!noAutoRegister) {
      module.tasks.push(fulltaskname);
    }

  }
532760
function(tasks, callback) {

      var keys; var length; var i; var results; var kind;
      var updated_tasks = [];
      var is_object;
      var counter = 0;

      if (isArray(tasks)) {

        length = tasks.length;
        results = [];

      } else if (isObject(tasks)) {

        is_object = true;
        keys = ObjectKeys(tasks);
        length = keys.length;
        results = {};

      } else {
        return callback();
      }

      for (i=0; i<length; i++) {

        if (is_object) {
          updated_tasks.push({ k: keys[i], t: tasks[keys[i]] });
        } else {
          updated_tasks.push({ k: i, t: tasks[i] });
        }

      }

      updated_tasks.forEach(function(task_object) {

        task_object.t(function(err, result) {
          if (err) return callback(err);

          results[task_object.k] = result;

          counter++;
          if (counter == length) callback(null, results);
        });

      });

    }
376861
function compressJS() {
    let tasks = [];

    Object.keys(config.tasks).forEach((key) => {
        let val = config.tasks[key];
        tasks.push(gulp.src(val.src)
            .pipe(plumber({ errorHandler: handleErrors }))
            .pipe(uglify())
            .pipe(rename(config.rename))
            .pipe(gulp.dest(val.dest)));
    });

    return merge(tasks);
}
142802
function glupost(configuration) {

   const tasks = configuration.tasks || {}
   const template = configuration.template || {}

   // Expand template object with defaults.
   expand(template, { transforms: [], dest: "." })


   // Create tasks.
   const names = Object.keys(tasks)
   for (const name of names) {
      const task = retrieve(tasks, name)

      if (typeof task === "object")
         expand(task, template)

      gulp.task(name, compose(task))
   }

   watch(tasks)

}
265994
function concatJS() {
    let tasks = [];

    Object.keys(config).forEach((key) => {
        let val = config[key];
        tasks.push(gulp.src(val.src)
            .pipe(plumber({ errorHandler: handleErrors }))
            .pipe(concat(key + '.js'))
            .pipe(gulp.dest(val.dest)));
    });

    return merge(tasks);
}
8385
function startRequested() {
		var start = [];

		if (run.length) {
			run.forEach(function(task) {
				var exists = task.replace(/:.*$/, '') in definitions.task;

				console.log(
					'Task %s %s',
					exists ? chalk.green(task) : chalk.red(task),
					exists ? 'running' : 'not found!'
				);

				if (exists) {
					start.push(task);
				}
			});

			if (start.length) {
				gulp.start.apply(gulp, start.concat([function(error) {
					if (error) {
						throw new Error(error);
					}

					console.log('Complete');
				}]));
			}
			else {
				console.log(chalk.red('No tasks are running, exiting!'));
				process.exit(1);
			}
		}

		return !!start.length;
	}
1142656
function(task, context, args) {
            // can used to default task
            if (!_.isFunction(task)) {
                args = task;
                task = null;
                context = null;
            }

            if (!_.isArray(args)) args = [args];

            var d = Q.defer();
            this.tasks.push({
                "task": task,
                "args": args || [],
                "context": context,
                "result": d
            });
            if (this.empty == true) {
                this.startNext();
            }
            return d.promise;
        }