diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2021-01-06 21:01:33 +0100 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2021-01-06 21:01:33 +0100 |
commit | ede2372547db659e7b0e9cfd3b531ff542018229 (patch) | |
tree | 433dcb7d2bf84c6cc0ee30d92c32c6220dc53641 /module/ri-engine/src/main/java/io/trygvis | |
parent | 149cf9efadb1da64b9ee716ac9bee1ac0c0e1329 (diff) | |
download | rules-sandbox-ede2372547db659e7b0e9cfd3b531ff542018229.tar.gz rules-sandbox-ede2372547db659e7b0e9cfd3b531ff542018229.tar.bz2 rules-sandbox-ede2372547db659e7b0e9cfd3b531ff542018229.tar.xz rules-sandbox-ede2372547db659e7b0e9cfd3b531ff542018229.zip |
Generating Wireguard files too.
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); |