Creates a GulpRunner.

A GulpRunner is a Vinyl transform stream that spawns a child process to
transform the file. A separate process is spawned to handle each file
passing through the stream.

@param {string} template
@param {object} options
503332
function GulpRunner(template, options) {
  if (!(this instanceof GulpRunner)) {
    return new GulpRunner(template, options);
  }

  this.command = new Command(template, options || {});
  Transform.call(this, { objectMode: true });
}
1050961
function getTemplateStream( src ) {
    return gulp.src( src )
        .pipe( $.templateCompile( {
            namespace: 'Example.Template',
            IIFE: false
        } ) )
        .pipe( $.replace( /\r*\n/g, '' ) );
}
244325
function(params, options) {
      var t = this;

      // If raw text was sent to the template, compile and return
      if (t.get('text')) {
        t.compile();
        return;
      }

      // Watch for changes in the text element
      t.on('change:text', t.compile, t);

      // Process a file template
      var path = t.get('path');
      if (path) {
        // Load the file
        if (t.asyncLoad) {
          FS.readFile(path, function(err, text) {
            if (err) {
              return console.error('Error reading file: ' + path, err);
            }
            t.set({text: text.toString()});
          });
        } else {
          t.set({text: FS.readFileSync(path).toString()});
        }

        // Watch the file for changes
        if (t.get('watchFile')) {
          t._watchFile();
        }
      }
    }
986563
function() {
  gulp.task('tpl-precompile', function() {
    return gulp.src([paths.src.partials])
    .pipe($.htmlmin({
      removeComments: true,
      collapseWhitespace: plugins.tpls.ext === '.jade' ? false : true
    }))
    .pipe(plugins.tpls.cmd(plugins.tpls.config))
    .on('error', handleError)
    .pipe($.defineModule('plain'))
    .pipe($.declare({
      namespace: 'R.templates',
      processName: function(file) {
        var dir = config.paths.src.partials || config.paths.src.templates;
        return file.slice(file.indexOf(dir) + dir.length).replace('.js', '');
      }
    }))
    .pipe($.concat('templates.js'))
    .pipe(gulp.dest(paths.out.js));
  });

  /* Template livereloading  */
  gulp.task('tpl-reload', ['tpl-precompile'], function() {
    return gulp.src([paths.src.views])
    .pipe($.livereload(lrport));
  });
}
1359399
def generate(template_options, color_option)
      templates.each do |src, dst|
        source      = @source_path.join(src)
        destination = @target_path.join(dst).to_s
        next unless ::File.exist?(source)
        within_root_path do
          TTY::File.copy_file(source, destination,
                    { context: template_options }.merge(color_option))
        end
      end
    end
440959
function(options) {
    var stream = through.obj(function(file, enc, cb) {
        var out = options.out;

        // Convert to the main file to a vinyl file
        options.out = function(text) {
            cb(null, new gutil.File({
                path: out,
                contents: new Buffer(text)
            }));
        };

        // Optimize the main file
        requirejs.optimize(options, null, function(err) {
            stream.emit('error', new gutil.PluginError('gulp-rjs', err.message));
        });
    });

    return stream;
}
1329228
function tasks(options) {
  options = options || {};
  var fp = path.resolve(options.template);
  var tmpl = new utils.File({path: fp, contents: fs.readFileSync(fp)});
  var data = {tasks: []};

  return utils.through.obj(function(file, enc, next) {
    var description = options.description || file.stem;

    if (typeof description === 'function') {
      description = options.description(file);
    }

    data.tasks.push({
      alias: 'gitignore',
      path: path.relative(path.resolve('generators'), file.path),
      name: file.stem.toLowerCase(),
      description: description,
      relative: file.relative,
      basename: '.gitignore'
    });

    next();
  }, function(next) {
    tmpl.data = data;
    this.push(tmpl);
    next();
  });
}
323465
function XUnit(runner, options) {
  Base.call(this, runner, options);

  var stats = this.stats;
  var tests = [];
  var self = this;

  // the name of the test suite, as it will appear in the resulting XML file
  var suiteName;

  // the default name of the test suite if none is provided
  var DEFAULT_SUITE_NAME = 'Mocha Tests';

  if (options && options.reporterOptions) {
    if (options.reporterOptions.output) {
      if (!fs.createWriteStream) {
        throw createUnsupportedError('file output not supported in browser');
      }

      mkdirp.sync(path.dirname(options.reporterOptions.output));
      self.fileStream = fs.createWriteStream(options.reporterOptions.output);
    }

    // get the suite name from the reporter options (if provided)
    suiteName = options.reporterOptions.suiteName;
  }

  // fall back to the default suite name
  suiteName = suiteName || DEFAULT_SUITE_NAME;

  runner.on(EVENT_TEST_PENDING, function(test) {
    tests.push(test);
  });

  runner.on(EVENT_TEST_PASS, function(test) {
    tests.push(test);
  });

  runner.on(EVENT_TEST_FAIL, function(test) {
    tests.push(test);
  });

  runner.once(EVENT_RUN_END, function() {
    self.write(
      tag(
        'testsuite',
        {
          name: suiteName,
          tests: stats.tests,
          failures: 0,
          errors: stats.failures,
          skipped: stats.tests - stats.failures - stats.passes,
          timestamp: new Date().toUTCString(),
          time: stats.duration / 1000 || 0
        },
        false
      )
    );

    tests.forEach(function(t) {
      self.test(t);
    });

    self.write('</testsuite>');
  });
}
751406
function gulpHtml2pug(options = {}) {
  // creating a stream through which each file will pass
  return through.obj(function (file, enc, cb) {
    const newFile = file.clone();

    vinylToString(file, enc)
      .then(html => html2pug(html, options))
      .then((pug) => {
        if (file.isBuffer()) {
          newFile.contents = Buffer.from(pug);
        } else if (file.isStream()) {
          // start the transformation
          newFile.contents = through();
          newFile.contents.end(pug);
        } else {
          throw new PluginError(PLUGIN_NAME, 'Invalid file');
        }

        const dirname = path.dirname(file.path);
        const basename = path.basename(file.path, path.extname(file.path));
        newFile.path = path.join(dirname, `${basename}.pug`);
        // make sure the file goes through the next gulp plugin
        this.push(newFile);
        cb();
      });
  });
}
1014901
function template(pattern) {
    return app.src(pattern, { cwd: path.join(__dirname, 'templates') })
      .pipe(app.renderFile('*')).on('error', console.error)
      .pipe(app.conflicts(app.cwd))
      .pipe(app.dest(app.options.dest || app.cwd));
  }
1161495
function renderTemplate(impl, targetFile){
	var stappoImpl = fs.readFileSync(impl, "utf8");
	return gulp.src([targetFile])
		.pipe(replace('/*__stappo_impl__*/', stappoImpl));
}
139505
function createTask(gulp, options, taskFile){
	var fn;
	var extension = path.extname(taskFile);
	var filename = path.basename(taskFile, extension);
	var task = require(taskFile)(gulp, options.data, loadGulpConfig.util, filename);
	if(Array.isArray(task)){
		fn = isFunction(task[task.length - 1]) ? task.pop() : void(0);
		gulp.task(filename, task, fn);
	}else if(isString(task)){
		gulp.task(filename, [task]);
	}else if(isFunction(task)){
		gulp.task(filename, task);
	}else if(isExotic(task)){
		keys(task).map(mapTaskObject.bind(this, filename, task)).forEach(function(task){
			if(task.cmds){
				if(isFunction(task.fn)){
					gulp.task(task.name, task.cmds, task.fn);
				}else{
					gulp.task(task.name, task.cmds);
				}
			}else{
				gulp.task(task.name, task.fn);
			}
		});
	}
}
194669
function gulpWPpot (options) {
  if (options !== undefined && !isObject(options)) {
    throw new PluginError('gulp-wp-pot', 'Require a argument of type object.');
  }

  const files = [];

  const stream = through.obj(function (file, enc, cb) {
    if (file.isStream()) {
      this.emit('error', new PluginError('gulp-wp-pot', 'Streams are not supported.'));
    }

    files.push(file.path);
    cb();
  }, function (cb) {
    if (!options) {
      options = {};
    }

    options.src = files;
    options.writeFile = false;

    try {
      const potContents = wpPot(options);
      const potFile = new Vinyl({
        contents: Buffer.from(potContents),
        path: '.'
      });

      this.push(potFile);
      this.emit('end');

      cb();
    } catch (error) {
      this.emit('error', new PluginError('gulp-wp-pot', error));
    }
  });

  return stream;
}
428436
function generateCode(taskOptions) {
  try {
    // Perform initialization tasks
    const model = taskOptions.swagger;
    debug('Processing configuration');
    const config = defaults(taskOptions, configDefaults);
    debug('  Initializing template engine');
    const templateEngine = taskOptions.templateEngine(taskOptions);
    debug('  Mapping definitions from file');
    const definitionMap = taskOptions.definitionMapper(model);

    // Execute definition templates
    /* istanbul ignore else - Trivial case */
    if (config.perDefinition) {
      debug('  Executing per-definition templates:');
      for (const templateFile of Object.keys(config.perDefinition)) {
        debug('    Iterating template: %s', templateFile);
        const options = defaults(config.perDefinition[templateFile], {
          extension: '.js',
          operations: ['get', 'put', 'post', 'delete'],
        });
        const template = taskOptions.templateLoader(templateEngine)
          .loadTemplate(templateFile, taskOptions.textEncoding);
        for (const definitionKey of Object.keys(definitionMap)) {
          const definition = definitionMap[definitionKey];

          debug('      Processing definition %s', definitionKey);
          // Copy fields from options into definition for
          const context = {
            model,
            definition,
            definitionMap,
            options,
          };

          debug('      Rendering template');
          const output = template(context);
          const subPath = path.join(options.target,
            definition.definitionName.toLowerCase() +
            options.extension);
          taskOptions.output(subPath, output);
        }
      }
    } else {
      debug('    No per-definition templates specified in perDefinition');
    }

    // Execute path templates
    if (config.perPath) {
      debug('  Executing per-path templates:');
      for (const templateFile of Object.keys(config.perPath)) {
        debug('    Processing template: %s', templateFile);
        const options = defaults(config.perPath[templateFile], {
          extension: '.js',
          operations: ['get', 'put', 'post', 'delete'],
        });
        const template = taskOptions.templateLoader(templateEngine)
          .loadTemplate(templateFile, taskOptions.textEncoding);
        debug('    Iterating paths, grouping operations by %s', options.groupBy);

        const groups = {};

        for (const pathString of Object.keys(model.paths)) {
          debug('      Path: %s', pathString);
          const pathDef = model.paths[pathString];
          let groupKey = pathDef[options.groupBy];
          pathDef.pathString = pathString;

          // Iterate through the allowed operations
          for (const operationString of _.intersection(Object.keys(pathDef), options.operations)) {
            debug('        Operation: %s', operationString);
            const operationDef = model.paths[pathString][operationString];
            groupKey = operationDef[options.groupBy] || groupKey;
            operationDef.pathDef = pathDef;
            operationDef.operationString = operationString;

            // We need a grouping key at either operation or path level
            /* istanbul ignore if */
            if (groupKey === null || groupKey === undefined) {
              throw new Error(util.format(
                'Cannot map path operation. No groupBy match at path/operation level: %s/%s [%s]',
                pathString,
                operationString,
                options.groupBy));
            }
            debug('          Assigned to output group: %s', groupKey);

            // If the group does not exist, create it
            if (groups[groupKey] === undefined) {
              groups[groupKey] = [];
            }

            // Add to group
            groups[groupKey].push(operationDef);
          } // per operationString
        } // per pathString

        debug('    Rendering template for %s group(s)', Object.keys(groups).length);
        for (const groupKey of Object.keys(groups)) {
          debug('      Processing group: %s', groupKey);

          const context = {};
          context.fileName = groupKey.trim().toLowerCase();
          context.groupKey = groupKey;
          context.members = groups[groupKey];
          context.definitionMap = definitionMap;
          context.model = model;
          context.options = options;

          const output = template(context);
          const subPath = path.join(options.target,
            context.fileName + options.extension);
          taskOptions.output(subPath, output);
        }
      } // per templateFile
    } // if perPath
  } catch (err) {
    /* istanbul ignore next - We don't wan't to test process.exit */
    taskOptions.failureHandler(err);
  }
}
987625
public String process(String templateName, String templateSource, Map<String, Object> params) {
        try {
            Template template = new Template(templateName, templateSource, configuration);
            Writer writer = new StringWriter();
            template.process(params, writer);
            return writer.toString();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
334204
function(str) {
            var output;
            try {
                output = opts.template(str);
            } catch (e) {
                e.message = error.badTemplate + ': ' + e.message;
                return this.emit('error', new PluginError('gulp-concat-filenames', e));
            }

            if (typeof output !== 'string') {
                return this.emit('error', new PluginError('gulp-concat-filenames', error.badTemplate));
            }
            return output;
        }
1252457
def create_template
        if File.directory?(FileUtils.join_paths(JumpStart.templates_path, @template_name))
          puts "\nThe directory #{FileUtils.join_paths(JumpStart.templates_path, @template_name).red} already exists. The template will not be created."
          exit_normal
        else
          FileUtils.mkdir_p(FileUtils.join_paths(JumpStart.templates_path, @template_name, "/jumpstart_config"))
          yaml = IO.read(FileUtils.join_paths(ROOT_PATH, "/source_templates/template_config.yml"))
          File.open(FileUtils.join_paths(JumpStart.templates_path, @template_name, "/jumpstart_config", "#{@template_name}.yml"), 'w') do |file|
            file.puts yaml
          end
          puts "The template #{@template_name.green} has been generated.\n"
        end
      end