sdelamo commented on code in PR #256:
URL: https://github.com/apache/groovy-geb/pull/256#discussion_r1944455525


##########
buildSrc/src/main/groovy/org/gebish/gradle/ManualsPlugin.groovy:
##########
@@ -56,21 +60,25 @@ class ManualsPlugin implements Plugin<Project> {
         }
     }
 
-    private void configureGenerateConfigPropertiesTask(
-        Project project, BaseExtension baseExtension, ManualsExtension 
manualsExtension
-    ) {
-        def currentVersion = manualsExtension.includedManuals.map {
-            baseExtension.isSnapshot() ? it.last() : project.version
+    private void configureIndexTask(Project project) {
+        project.tasks.register("generateIndex", WriteProperties) {
+            destinationFile = project.layout.buildDirectory.file("index.html")
+            doLast {
+                def baseExtension = project.extensions.getByType(BaseExtension)
+                def ext = project.extensions.getByName("manuals")
+                List<String> includedManuals = ext.includedManuals.get()
+                String currentVersion = baseExtension.isSnapshot() ? 
includedManuals.last() : project.version
+                String snapshot = baseExtension.isSnapshot() ? project.version 
: ''
+                List<String> oldManuals = includedManuals.findAll {v -> v != 
currentVersion }
+                Map<String, String> model = [old: oldManuals, current: 
currentVersion, snapshot: snapshot]
+                String template = 
readFileContent(ext.indexTemplate.asFile.get())
+                String html = new 
SimpleTemplateEngine().createTemplate(template).make(model).toString()
+                destinationFile.get().asFile.text = html
+            }
         }
+    }
 
-        project.tasks.register("generateConfigProperties", WriteProperties) {
-            destinationFile = 
project.layout.buildDirectory.file("config-properties/ratpack.properties")
-
-            property("manuals.old", manualsExtension.includedManuals.map {
-                (it - currentVersion.get()).reverse().join(",")
-            })
-            property("manuals.current", currentVersion)
-            property("manuals.snapshot", baseExtension.isSnapshot() ? 
project.version : '')
-        }
+    private String readFileContent(File file) {

Review Comment:
   resolved via 
https://github.com/apache/groovy-geb/pull/256/commits/1cf394f8f3f4b876b0dfd64ddeb0a4ea19cb5b54



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to