in ruler-common/src/main/java/com/spotify/ruler/common/report/HtmlReporter.kt [31:44]
fun generateReport(json: String, targetDir: File): File {
var html = readResourceFile("index.html")
// Inline Javascript
val javascript = readResourceFile("ruler-frontend.js")
html = html.replaceFirst("<script src=\"ruler-frontend.js\"></script>", "<script>$javascript</script>")
// Inline JSON data
html = html.replaceFirst("\"REPLACE_ME\"", "`$json`")
val reportFile = targetDir.resolve("report.html")
reportFile.writeText(html)
return reportFile
}