1
0

Separate templates

This commit is contained in:
2020-09-10 19:08:31 +02:00
parent ddf8558578
commit 8ba3dac0b2
16 changed files with 86 additions and 46 deletions
+8 -8
View File
@@ -1,23 +1,23 @@
package starter
import starter.templates.Template
import starter.utils.ZipOutput
import starter.utils.prettyPrintXml
import starter.utils.sanitizeFilename
class ProjectZip(private val templates: Templates) {
fun createZip(project: Project, inputs: List<Input>, dependencies: List<Dependency>): String {
val pom = templates.pom(dependencies, inputs)
val prettyPom = prettyPrintXml(pom)
class ProjectZip(private val templates: List<Template>) {
fun createZip(project: Project): String {
val name: String
ZipOutput(sanitizeFilename(project.name)).use {
name = it.name
it.write("pom.xml", prettyPom)
templates.forEach { template ->
it.write(template.path(project), template.render(project))
}
}
return name
}
}
}