Fix readme again
This commit is contained in:
parent
a6c7287bb1
commit
a871db0c15
@ -128,7 +128,7 @@ open class KScienceProjectPlugin : Plugin<Project> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
val rootReadmeProperties: Map<String, Any?> =
|
val rootReadmeProperties: Map<String, Any?> =
|
||||||
rootReadmeExtension.properties + ("modules" to modulesString)
|
rootReadmeExtension.actualizedProperties + ("modules" to modulesString)
|
||||||
|
|
||||||
readmeFile.writeText(
|
readmeFile.writeText(
|
||||||
SimpleTemplateEngine().createTemplate(rootReadmeExtension.readmeTemplate)
|
SimpleTemplateEngine().createTemplate(rootReadmeExtension.readmeTemplate)
|
||||||
|
@ -46,30 +46,31 @@ class KScienceReadmeExtension(val project: Project) {
|
|||||||
features.add(Feature(id, description(), ref, name))
|
features.add(Feature(id, description(), ref, name))
|
||||||
}
|
}
|
||||||
|
|
||||||
val properties: MutableMap<String, () -> Any?> = mutableMapOf(
|
private val properties: MutableMap<String, () -> Any?> = mutableMapOf(
|
||||||
"name" to { project.name },
|
"name" to { project.name },
|
||||||
"group" to { project.group },
|
"group" to { project.group },
|
||||||
"version" to { project.version },
|
"version" to { project.version },
|
||||||
"features" to { featuresString() }
|
"features" to { featuresString() }
|
||||||
)
|
)
|
||||||
|
|
||||||
private fun getActualizedProperties() = properties.mapValues { (_, value) ->
|
val actualizedProperties
|
||||||
value.invoke()
|
get() = properties.mapValues { (_, value) ->
|
||||||
}
|
value.invoke()
|
||||||
|
}
|
||||||
|
|
||||||
fun property(key: String, value: Any?) {
|
fun property(key: String, value: Any?) {
|
||||||
properties[key] = { value }
|
properties[key] = { value }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun propertyByTemplate(key: String, template: String) {
|
fun propertyByTemplate(key: String, template: String) {
|
||||||
val actual = getActualizedProperties()
|
val actual = actualizedProperties
|
||||||
properties[key] = { SimpleTemplateEngine().createTemplate(template).make(actual).toString() }
|
properties[key] = { SimpleTemplateEngine().createTemplate(template).make(actual).toString() }
|
||||||
}
|
}
|
||||||
|
|
||||||
internal val additionalFiles = ArrayList<File>()
|
internal val additionalFiles = ArrayList<File>()
|
||||||
|
|
||||||
fun propertyByTemplate(key: String, template: File) {
|
fun propertyByTemplate(key: String, template: File) {
|
||||||
val actual = getActualizedProperties()
|
val actual = actualizedProperties
|
||||||
properties[key] = { SimpleTemplateEngine().createTemplate(template).make(actual).toString() }
|
properties[key] = { SimpleTemplateEngine().createTemplate(template).make(actual).toString() }
|
||||||
additionalFiles.add(template)
|
additionalFiles.add(template)
|
||||||
}
|
}
|
||||||
@ -88,7 +89,7 @@ class KScienceReadmeExtension(val project: Project) {
|
|||||||
*/
|
*/
|
||||||
fun readmeString(): String? {
|
fun readmeString(): String? {
|
||||||
return if (readmeTemplate.exists()) {
|
return if (readmeTemplate.exists()) {
|
||||||
val actual = getActualizedProperties()
|
val actual = actualizedProperties
|
||||||
SimpleTemplateEngine().createTemplate(readmeTemplate).make(actual).toString()
|
SimpleTemplateEngine().createTemplate(readmeTemplate).make(actual).toString()
|
||||||
} else {
|
} else {
|
||||||
null
|
null
|
||||||
|
Loading…
Reference in New Issue
Block a user