Run the generator

@param $templatePath
@param $templateData
@param $filePathToGenerate
972557
public function make($templatePath, $templateData, $filePathToGenerate)
    {
        // We first need to compile the template,
        // according to the data that we provide.
        $template = $this->compile($templatePath, $templateData, new TemplateCompiler);

        // Now that we have the compiled template,
        // we can actually generate the file.
        $this->file->make($filePathToGenerate, $template);
    }
111377
public function load(string $templatePath): TemplateInterface
    {
        $path = $this->resolveCachedTemplatePath($templatePath);
        $class = $this->generateTemplateCacheClass($path);

        return $this->compileAndSaveTemplate(
            $this->finder->getContents($path),
            $this->resolveCacheTemplatePath($class),
            $class
        );
    }
510548
protected void rrdToolUpdate(String template, String data) throws Exception {
		List<String> commands = new ArrayList<>();
		commands.add(binaryPath + "/rrdtool");
		commands.add("update");
		commands.add(outputFile.getCanonicalPath());
		commands.add("-t");
		commands.add(template);
		commands.add("N:" + data);

		ProcessBuilder pb = new ProcessBuilder(commands);
		Process process = pb.start();
		checkErrorStream(process);
	}
381880
private function validateTemplate($template, $templateList)
    {
        if (empty($template)) {
            throw new \Exception('The template name is required.');
        }

        if (!in_array($template, $templateList)) {
            throw new \InvalidArgumentException(
                sprintf('The template "%s" does not exist, use: %s', $template, implode(', ', $templateList))
            );
        }
    }
821662
public function renderTemplate($templatePath = null, $data = [])
    {
        $renderedTemplate = $this->view->renderTemplate($templatePath, $data);
        return $renderedTemplate;
    }
928286
private function setTemplatesPath($templatesPath)
    {
        $this->templatesPath = $templatesPath;
        if (!is_readable($this->templatesPath)) {
            $this->error("Template Root Path ({$this->templatesPath}) does not exist or not readable.");
        }
    }
722442
private void process( Collection<File> templateFiles ) {

		// Compile them all
		Collection<TemplateEntry> templateEntries = new ArrayList<> ();
		for( File f : templateFiles ) {
			final TemplateEntry templateEntry = compileTemplate( f );
			if( templateEntry != null )
				templateEntries.add( templateEntry );
		}

		// Add all the template entries
		this.lock.writeLock().lock();
		try {
			for( final TemplateEntry te : templateEntries )
				this.fileToTemplate.put( te.getTemplateFile(), te );

		} finally {
			this.lock.writeLock().unlock();
		}

		// Notify the templating manager
		this.manager.processNewTemplates( templateEntries );
	}
408287
private static void renderFreemarkerTemplate(Path templatePath, Map vars, Path outputPath)
            throws IOException, TemplateException
    {
        if(templatePath == null)
            throw new WindupException("templatePath is null");

        freemarker.template.Configuration freemarkerConfig = new freemarker.template.Configuration(freemarker.template.Configuration.VERSION_2_3_26);
        DefaultObjectWrapperBuilder objectWrapperBuilder = new DefaultObjectWrapperBuilder(freemarker.template.Configuration.DEFAULT_INCOMPATIBLE_IMPROVEMENTS);
        objectWrapperBuilder.setUseAdaptersForContainers(true);
        objectWrapperBuilder.setIterableSupport(true);
        freemarkerConfig.setObjectWrapper(objectWrapperBuilder.build());
        freemarkerConfig.setTemplateLoader(new FurnaceFreeMarkerTemplateLoader());
        Template template = freemarkerConfig.getTemplate(templatePath.toString().replace('\\', '/'));
        try (FileWriter fw = new FileWriter(outputPath.toFile()))
        {
            template.process(vars, fw);
        }
    }
1364288
public function compile($templatePath, Array $templateData, $filePath)
    {
        $template = $this->filesystem->get($templatePath);

        $compiled = $this->compiler->compile($template, $templateData);

        $this->makeDirectory(dirname($filePath));

        $this->filesystem->put($filePath, $compiled);

        return $filePath;
    }
1256928
protected function generateFromTemplate($template, $fileName, $path)
    {
        $file = $this->loadTemplate($template);
        $content = $this->replaceValues( $file );
        $this->createFile( $fileName, $path, $content );

        return true;
    }
1011983
private function compileTemplate($templatePath, $destinationPath, $data = null)
    {
        if ($data == null) {
            $data = $destinationPath;
            $destinationPath = null;
        }
        
        if (! isset($this->templates[$templatePath])) {
            $this->templates[$templatePath] = file_get_contents($templatePath);
        }
        
        $compiled = preg_replace_callback('/{{\s*([A-z0-9_-]+)\s*}}/', function ($matches) use ($data) {
            if (isset($data[$matches[1]])) {
                return $data[$matches[1]];
            }
            
            return $matches[0];
        }, $this->templates[$templatePath]);
        
        if ($destinationPath) {
            file_put_contents($destinationPath, $compiled);
        }
        
        return $compiled;
    }
1003555
public void runWholeFilesetPasses(SoyFileSetNode soyTree, TemplateRegistry templateRegistry) {
    ImmutableList<SoyFileNode> sourceFiles = ImmutableList.copyOf(soyTree.getChildren());
    IdGenerator idGenerator = soyTree.getNodeIdGenerator();
    for (CompilerFileSetPass pass : crossTemplateCheckingPasses) {
      CompilerFileSetPass.Result result = pass.run(sourceFiles, idGenerator, templateRegistry);
      if (result == CompilerFileSetPass.Result.STOP) {
        break;
      }
    }
  }
372557
public function render($templatePath)
    {
        if(!is_file($templatePath) || !is_readable($templatePath))
        {
            throw new FileNotFoundException(sprintf('Template file "%s" does not exists.',
                                                    $templatePath));
        }
        if (!is_readable($templatePath))
        {
            throw new FileNotReadableException(sprintf('Template file "%s" is not readable.',
                                                       $templatePath));
        }
        try
        {
            extract($this->getTemplateVars());
            ob_start();
            /** @noinspection PhpIncludeInspection */
            require $templatePath;
            $contents = ob_get_clean();
        }
        catch(\Exception $e)
        {
            ob_clean();
            throw new TemplateException(sprintf('Error rendering template. %s', $e->getMessage()));
        }

        return $contents;
    }
540188
public function template($template, $data = [])
    {
        $templatePath = self::$instance->app->findTemplate($template);
        echo self::$instance->renderTemplate($templatePath, $data);
    }
264266
private void generate(TemplateFile input, List<OutputFile> outputs, TemplateOptions templateOptions) throws IOException {
    final String targetFileName = targetFileName(templatesPath.relativize(input.path).toString(), templateOptions);
    final OutputFile output = new OutputFile(outputPath.resolve(targetFileName).toAbsolutePath().normalize());

    if (incremental &&
        Files.exists(output.path) &&
        Files.getLastModifiedTime(output.path).toMillis() >= Files.getLastModifiedTime(input.path).toMillis()) {
      // No need to re-render but mark as generated.
      output.upToDate = true;
      outputs.add(output);
      return;
    }

    String template = new String(Files.readAllBytes(input.path), StandardCharsets.UTF_8);

    timeVelocity.start();
    template = filterVelocity(input, template, templateOptions);
    timeVelocity.stop();

    // Check if template requested ignoring a given type combination.
    if (templateOptions.isIgnored()) {
      return;
    }

    getLog().debug("Processing: " + input.getFileName() + " => " + output.path);
    try {
      timeIntrinsics.start();
      template = filterIntrinsics(template, templateOptions);
      timeIntrinsics.stop();
  
      timeComments.start();
      template = filterComments(template);
      timeComments.stop();
  
      timeTypeClassRefs.start();
      template = filterTypeClassRefs(template, templateOptions);
      template = filterStaticTokens(template, templateOptions);
      timeTypeClassRefs.stop();
    } catch (RuntimeException e) {
      getLog().error("Error processing: " + input.getFileName() + " => " + output.path + ":\n\t" + e.getMessage());
      throw e;
    }

    Files.createDirectories(output.path.getParent());
    Files.write(output.path, template.getBytes(StandardCharsets.UTF_8));

    outputs.add(output);
  }
616109
public void run() throws TemplateException {
	{
	    // tags
	    Iterator<TagData> it = tags.iterator();
	    while (it.hasNext()) {
		TagData td = it.next();
		SourceCode cfml = td.cfml;
		cfml.setPos(td.pos);
		try {
		    if (td.libTag.getEvaluator() != null) td.libTag.getEvaluator().evaluate(td.tag, td.libTag, td.flibs);
		}
		catch (EvaluatorException e) {
		    clear();// print.printST(e);
		    throw new TemplateException(cfml, e);
		}
		catch (Throwable e) {
		    ExceptionUtil.rethrowIfNecessary(e);
		    clear();
		    throw new TemplateException(cfml, e);
		}

	    }
	    tags.clear();
	}
	// functions
	Iterator<FunctionData> it = functions.iterator();
	while (it.hasNext()) {
	    FunctionData td = it.next();
	    SourceCode cfml = td.cfml;
	    cfml.setPos(td.pos);
	    try {
		if (td.flf.getEvaluator() != null) td.flf.getEvaluator().evaluate(td.bif, td.flf);
	    }
	    catch (EvaluatorException e) {
		clear();// print.printST(e);
		throw new TemplateException(cfml, e);
	    }
	    catch (Throwable e) {
		ExceptionUtil.rethrowIfNecessary(e);
		clear();
		throw new TemplateException(cfml, e);
	    }

	}
	functions.clear();

    }
732838
public void includeEscaped(String templatePath) throws IOException {
        URL resource = engine.resolveTemplate(templatePath);
        yield(ResourceGroovyMethods.getText(resource, engine.getCompilerConfiguration().getSourceEncoding()));
    }