diff options
Diffstat (limited to 'module/ri-engine/src/main/java/io/trygvis')
-rw-r--r-- | module/ri-engine/src/main/java/io/trygvis/rules/engine/TemplateEngine.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/module/ri-engine/src/main/java/io/trygvis/rules/engine/TemplateEngine.java b/module/ri-engine/src/main/java/io/trygvis/rules/engine/TemplateEngine.java index 3c7c755..cc085c0 100644 --- a/module/ri-engine/src/main/java/io/trygvis/rules/engine/TemplateEngine.java +++ b/module/ri-engine/src/main/java/io/trygvis/rules/engine/TemplateEngine.java @@ -2,6 +2,7 @@ package io.trygvis.rules.engine; import ch.qos.logback.core.util.FileUtil; import com.hubspot.jinjava.Jinjava; +import org.apache.commons.io.FileUtils; import java.io.File; import java.io.IOException; @@ -18,6 +19,15 @@ public class TemplateEngine { this.basedir = basedir; } + public void clean() { + try { + System.out.println("Cleaning gen!"); + FileUtils.deleteDirectory(basedir); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + public void template(String name, String output, Map<String, Object> params) throws IOException { var template = Files.readString(Path.of("j2", name + ".j2")); String renderedTemplate = jinjava.render(template, params); |