tasks = {
'task-name': {
'src': [file1, file2],
'tpl': '<script src="%s"></script>'
},
....
}
189478
function (options) {
        options = options || {};

        var utilExtensions = /%f|%e/g;
        var tasksByNames = {};

        var tasksPromises = Object.keys(options).map(function (name) {

            var task = {
                src: [],
                tpl: null,
                uni: {},
                srcIsNull: false
            };

            return Promise
                .resolve()
                .then(function () {
                    var item = options[name];
                    var src = typeof item.src !== 'undefined' ? item.src : item;

                    return resolveSrcString(src)
                      .then(function(srcStrings) {
                          task.srcIsNull = srcStrings === null;
                          task.src = task.src.concat(srcStrings);
                          task.tpl = item.tpl;
                      });
                })
                .then(function () {
                    var result;

                    while (result = utilExtensions.exec(task.tpl)) {
                        var type = result[0];
                        var unique = {};

                        if (task.uni[type]) {
                            continue;
                        }

                        unique.regex = new RegExp(result[0], "g");
                        unique.value = null;
                        task.uni[type] = unique;
                    }
                })
                .then(function () {
                    tasksByNames[name] = task;
                });
        });

        return Promise.all(tasksPromises)
            .then(function() {
               return tasksByNames;
        });
    }
481674
def _submit_task_with_template(self, task_ids):
        ''''''
        runtime = self.config
        runtime.update({
            'workdir': os.getcwd(),
            'cur_dir': os.getcwd(),  # for backward compatibility
            'verbosity': env.verbosity,
            'sig_mode': env.config.get('sig_mode', 'default'),
            'run_mode': env.config.get('run_mode', 'run'),
            'home_dir': os.path.expanduser('~')
        })
        if '_runtime' in env.sos_dict:
            runtime.update({
                x: env.sos_dict['_runtime'][x]
                for x in ('nodes', 'cores', 'workdir', 'mem', 'walltime')
                if x in env.sos_dict['_runtime']
            })
        if 'nodes' not in runtime:
            runtime['nodes'] = 1
        if 'cores' not in runtime:
            runtime['cores'] = 1

        # let us first prepare a task file
        job_text = ''
        for task_id in task_ids:
            runtime['task'] = task_id
            try:
                job_text += cfg_interpolate(self.job_template, runtime)
                job_text += '\n'
            except Exception as e:
                raise ValueError(
                    f'Failed to generate job file for task {task_id}: {e}')

        filename = task_ids[0] + ('.sh' if len(task_ids) == 1 else
                                  f'-{task_ids[-1]}.sh')
        # now we need to write a job file
        job_file = os.path.join(
            os.path.expanduser('~'), '.sos', 'tasks', filename)
        # do not translate newline under windows because the script will be executed
        # under linux/mac
        with open(job_file, 'w', newline='') as job:
            job.write(job_text)

        # then copy the job file to remote host if necessary
        self.agent.send_task_file(job_file)

        try:
            cmd = f'bash ~/.sos/tasks/{filename}'
            self.agent.run_command(cmd, wait_for_task=self.wait_for_task)
        except Exception as e:
            raise RuntimeError(f'Failed to submit task {task_ids}: {e}')
        return True
521590
function pluck(path, cb) {
  var tasks = [];
  fs.readFile(path, 'utf8', function (err, str) {
    if (err) return cb(err);

    /**
     * Skip binary-files
     */

    if (isBinary(str)) return;

    /**
     * Pointer within the file
     */

    var lines = str.split('\n'),
        linum = 0;

    while (lines.length) {
      var line = lines.shift(); linum++;

      /**
       * Check for task-comment
       */

      if (!pattern.test(line)) continue;

      /**
       * Old-style comments
       * @see http://www.riedquat.de/TR/trunk/TODO_Syntax/
       */

      var matches = line.match(isoPattern);
      if (matches != null) {
        matches = matches.toString().split(':');
        var labels = ['#'+matches[0].toLowerCase()],
            added = new Date(matches[1]),
            assignee = '@'+matches[2].replace(/[\\s]*/, '-'),
            linestart = linum,
            title = matches[3],
            body = '';
      }

      /**
       * New-style comments
       *
       * TODO Write a comment specification
       *    | Should be located at the address below
       *
       * TODO Share patterns between modules
       *    | Perhaps even make all of them global
       *
       * @see http://hkjels.github.com/ntask/syntax.html
       */

      else {
        var added = new Date(),
            assignee = (line.match(/@[\w\[\d\]-_]*/g)||['@none'])[0],
            title = line.replace(new RegExp('.*('+KEYWORDS+')'), '')
              .replace(assignee, '')
              .replace(/[^a-z0-9\!\]\)]*$/i, '').trim(),
            linestart = linum,
            body = (function body() {
              var next = lines.shift();
              if (/[\\s]*[\\\*\%\-(" )"]{0,3}[\|]/g.test(next)) {
                linum++;
                return next.split('|').slice(1).join('').trim()+'\n'+body();
              }
              else {
                lines.unshift(next);
                return '';
              }
            })(),
            labels = ((title+body).match(/#[\w]*[\[\]a-f0-9\.]*/gi) || [])
              .map(lowertrim).filter(minlength),
            keyword = line.match(new RegExp('.*('+KEYWORDS+')'))[1].toLowerCase();
            labels.unshift('#'+keyword);
      }
      var done = labels.indexOf('#done') != -1;

      /**
       * Parsed task-object ready for model-validation
       */

      var task = {
          added: added
        , assignee: assignee
        , body: body
        , done: done
        , file: path
        , labels: labels
        , line: linestart
        , title: title
      };
      tasks.push(task);
    }
    cb(false, tasks);
  });
}
261319
function _client_compile_task(file) {

    var infile = amigo_js_dev_path + '/' +file;
    //var outfile = amigo_js_out_path + '/' +file;

    var b = browserify(infile);
    return b
    // not in npm, don't need in browser
	.exclude('ringo/httpclient')
	.bundle()
    // desired output filename to vinyl-source-stream
	.pipe(source(file))
	.pipe(gulp.dest(amigo_js_out_path));
}
677911
def _load_tasks(self, tasks, vars={}, additional_conditions=[]):
        '''  '''

        results = []
        if tasks is None:
            # support empty handler files, and the like.
            tasks = []

        for x in tasks:
            task_vars = self.vars.copy()
            task_vars.update(vars)
            if 'include' in x:
                tokens = shlex.split(x['include'])
                items = ['']
                included_additional_conditions = list(additional_conditions)
                for k in x:
                    if k.startswith("with_"):
                        plugin_name = k[5:]
                        if plugin_name not in utils.plugins.lookup_loader:
                            raise errors.AnsibleError("cannot find lookup plugin named %s for usage in with_%s" % (plugin_name, plugin_name))
                        terms = utils.template_ds(self.basedir, x[k], task_vars)
                        items = utils.plugins.lookup_loader.get(plugin_name, basedir=self.basedir, runner=None).run(terms, inject=task_vars)
                    elif k.startswith("when_"):
                        included_additional_conditions.append(utils.compile_when_to_only_if("%s %s" % (k[5:], x[k])))
                    elif k in ("include", "vars", "only_if"):
                        pass
                    else:
                        raise errors.AnsibleError("parse error: task includes cannot be used with other directives: %s" % k)

                if 'vars' in x:
                    task_vars.update(x['vars'])
                if 'only_if' in x:
                    included_additional_conditions.append(x['only_if'])

                for item in items:
                    mv = task_vars.copy()
                    mv['item'] = item
                    for t in tokens[1:]:
                        (k,v) = t.split("=", 1)
                        mv[k] = utils.template_ds(self.basedir, v, mv)
                    include_file = utils.template(self.basedir, tokens[0], mv)
                    data = utils.parse_yaml_from_file(utils.path_dwim(self.basedir, include_file))
                    results += self._load_tasks(data, mv, included_additional_conditions)
            elif type(x) == dict:
                results.append(Task(self,x,module_vars=task_vars, additional_conditions=additional_conditions))
            else:
                raise Exception("unexpected task type")

        for x in results:
            if self.tags is not None:
                x.tags.extend(self.tags)

        return results
410182
def get_contigs(self):
        ''''''
        contigs = {}
        pyfastaq.tasks.file_to_dict(self.contigs_fasta, contigs)
        return contigs
478303
def getTaskHelp(_Task):
  
  """
  Ret = []

  for k in ['name', 'desc']:
    v = _Task.Config.get(k)

    if v is not None:
      Ret.append('%s: %s' % (k, v))

  Args = _Task.Args

  if Args:
    Ret.append('\nArgs:')

    for argName, Arg in Args.items():
      Ret.append('  %s: %s' % (argName, Arg.get('desc', Arg['type_str'])))

    Ret.append('')

  return '\n'.join(Ret).rstrip()
454678
def task(*args, **kwargs):
	''' '''

	# support @task
	if args and hasattr(args[0], '__call__'):
		return _taskify(args[0])

	# as well as @task(), @task('default'), etc.
	else:
		def wrapper(func):
			global DEFAULT, SETUP, TEARDOWN
			func = _taskify(func)

			if 'default' in args:
				DEFAULT = func

			if 'setup' in args:
				SETUP = func

			if 'teardown' in args:
				TEARDOWN = func

			if 'private' in args:
				TASKS.remove(func)

			if 'method' in args:
				func.method = True
				func.args = func.args[1:]

			if 'consume' in args:
				func.consume = True

			if 'reqs' in kwargs:
				func.reqs = _tuplify(kwargs['reqs'])
				func.file_reqs = [req for req in func.reqs if type(req) is str]
				func.task_reqs = [req for req in func.reqs if type(req) is not str]

			if 'gens' in kwargs:
				func.gens = kwargs['gens']
				GENERATES[kwargs['gens']] = func

			if 'alias' in kwargs:
				func.aliases = _tuplify(kwargs['alias'])

			if 'namespace' in kwargs:
				func.ns = kwargs['namespace'] + '.' if kwargs['namespace'] else ''

			return func

		return wrapper
318836
function task(app, name, pattern) {
  app.task(name, function() {
    return app.src(pattern, {cwd: __dirname})
      .pipe(app.renderFile('*'))
      .pipe(app.conflicts(app.cwd))
      .pipe(app.dest(app.cwd));
  });
}
270727
def tasks_in_scope(scope)
      prefix = scope.join(":")
      tasks.select { |t|
        /^#{prefix}:/ =~ t.name
      }
    end
459581
function getAllTasks(directories, options) {
	const allTasks = getAllAliases(options);
	for (const dir of directories) {
		const tasks = glob.sync(`${dir}/*/index.js`);
		tasks.forEach(filename => {
			const taskName = path.basename(path.dirname(filename));
			if (!allTasks[taskName]) {
				const module = require(filename);
				allTasks[taskName] = module.description || '';
			}
		});
	}
	return allTasks;
}
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);
    }

  }
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`);
}
367630
function task(app, name, pattern, dependencies) {
  app.task(name, dependencies || [], function(cb) {
    return pattern ? file(app, pattern) : cb();
  });
}
608698
def split_task_parameters(line):
    
    if line is None:
        result = []
    else:
        result = [parameter.strip() for parameter in line.split(",")]
    return result
100613
def convert_to_rake()
      object_multitask = prepare_tasks_for_objects()

      res = typed_file_task get_rake_task_type(), get_task_name => object_multitask do
        cmd = calc_command_line
        Dir.chdir(@project_dir) do
          mapfileStr = @mapfile ? " >#{@mapfile}" : ""
          rd, wr = IO.pipe
          cmdLinePrint = cmd
          printCmd(cmdLinePrint, "Linking #{executable_name}", false) #OK
          cmd << {
            :out=> @mapfile ? "#{@mapfile}" : wr, # > xy.map
            :err=>wr
          }
          sp = spawn(*cmd)
          cmd.pop
          # for console print
          cmd << " >#{@mapfile}" if @mapfile
          consoleOutput = ProcessHelper.readOutput(sp, rd, wr)

          process_result(cmdLinePrint, consoleOutput, @tcs[:LINKER][:ERROR_PARSER], nil)
          check_config_file()
          post_link_hook(@tcs[:LINKER])
        end
      end
      res.tags = tags
      res.immediate_output = true
      res.enhance(@config_files)
      res.enhance([@project_dir + "/" + @linker_script]) if @linker_script

      add_output_dir_dependency(get_task_name, res, true)
      add_grouping_tasks(get_task_name)
      setup_rake_dependencies(res, object_multitask)

      # check that all source libs are checked even if they are not a real rake dependency (can happen if "build this project only")
      begin
        libChecker = task get_task_name+"LibChecker" do
          if File.exists?(get_task_name) # otherwise the task will be executed anyway
            all_dependencies.each do |bb|
              if bb and StaticLibrary === bb
                f = bb.get_task_name # = abs path of library
                if not File.exists?(f) or File.mtime(f) > File.mtime(get_task_name)
                  def res.needed?
                    true
                  end
                  break
                end
              end
            end
          end
        end
      rescue
        def res.needed?
          true
        end
      end
      libChecker.transparent_timestamp = true
      res.enhance([libChecker])

      return res
    end
843414
def execute_tasks(tasks,template_path)
      
      if File.exists?(File.expand_path(File.join(template_path,'tasks.rb')))
        load File.expand_path(File.join(template_path,'tasks.rb'))
      end
       
      tasks.each{
        |task|
        
        puts 'Running Task: ' + task
        
        task = replace_tags(task);
        
        options = task.split(', ')
        action = options.slice!(0)
        
        if(Tasks.respond_to?(action))
          Tasks.send action, options.join(', ')
        else
          send action, options.join(', ')
        end
        
      }
                  
    end