Separate templates
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user