From a871db0c15dbf87d88f2308a726695030a3d7fee Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Mon, 22 Feb 2021 21:50:29 +0300 Subject: [PATCH] Fix readme again --- .../ru/mipt/npm/gradle/KScienceProjectPlugin.kt | 2 +- .../ru/mipt/npm/gradle/KScienceReadmeExtension.kt | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/main/kotlin/ru/mipt/npm/gradle/KScienceProjectPlugin.kt b/src/main/kotlin/ru/mipt/npm/gradle/KScienceProjectPlugin.kt index 9e26f2d..c9280ee 100644 --- a/src/main/kotlin/ru/mipt/npm/gradle/KScienceProjectPlugin.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/KScienceProjectPlugin.kt @@ -128,7 +128,7 @@ open class KScienceProjectPlugin : Plugin { } val rootReadmeProperties: Map = - rootReadmeExtension.properties + ("modules" to modulesString) + rootReadmeExtension.actualizedProperties + ("modules" to modulesString) readmeFile.writeText( SimpleTemplateEngine().createTemplate(rootReadmeExtension.readmeTemplate) diff --git a/src/main/kotlin/ru/mipt/npm/gradle/KScienceReadmeExtension.kt b/src/main/kotlin/ru/mipt/npm/gradle/KScienceReadmeExtension.kt index cf8c027..25b362c 100644 --- a/src/main/kotlin/ru/mipt/npm/gradle/KScienceReadmeExtension.kt +++ b/src/main/kotlin/ru/mipt/npm/gradle/KScienceReadmeExtension.kt @@ -46,30 +46,31 @@ class KScienceReadmeExtension(val project: Project) { features.add(Feature(id, description(), ref, name)) } - val properties: MutableMap Any?> = mutableMapOf( + private val properties: MutableMap Any?> = mutableMapOf( "name" to { project.name }, "group" to { project.group }, "version" to { project.version }, "features" to { featuresString() } ) - private fun getActualizedProperties() = properties.mapValues { (_, value) -> - value.invoke() - } + val actualizedProperties + get() = properties.mapValues { (_, value) -> + value.invoke() + } fun property(key: String, value: Any?) { properties[key] = { value } } fun propertyByTemplate(key: String, template: String) { - val actual = getActualizedProperties() + val actual = actualizedProperties properties[key] = { SimpleTemplateEngine().createTemplate(template).make(actual).toString() } } internal val additionalFiles = ArrayList() fun propertyByTemplate(key: String, template: File) { - val actual = getActualizedProperties() + val actual = actualizedProperties properties[key] = { SimpleTemplateEngine().createTemplate(template).make(actual).toString() } additionalFiles.add(template) } @@ -88,7 +89,7 @@ class KScienceReadmeExtension(val project: Project) { */ fun readmeString(): String? { return if (readmeTemplate.exists()) { - val actual = getActualizedProperties() + val actual = actualizedProperties SimpleTemplateEngine().createTemplate(readmeTemplate).make(actual).toString() } else { null