groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pa...@apache.org
Subject [groovy-website] branch asf-site updated: add release dates to changelogs
Date Tue, 21 May 2019 06:29:21 GMT
This is an automated email from the ASF dual-hosted git repository.

paulk pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/groovy-website.git


The following commit(s) were added to refs/heads/asf-site by this push:
     new d45a708  add release dates to changelogs
d45a708 is described below

commit d45a7082c73539c5134dc8474d447cf191ef339b
Author: Paul King <paulk@asert.com.au>
AuthorDate: Tue May 21 16:29:12 2019 +1000

    add release dates to changelogs
---
 .../src/main/groovy/generator/ChangelogParser.groovy     | 16 +++++++++-------
 site/src/site/pages/changelogs.groovy                    | 10 ++++++----
 2 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/generator/src/main/groovy/generator/ChangelogParser.groovy b/generator/src/main/groovy/generator/ChangelogParser.groovy
index ea9e075..c5dc813 100644
--- a/generator/src/main/groovy/generator/ChangelogParser.groovy
+++ b/generator/src/main/groovy/generator/ChangelogParser.groovy
@@ -35,11 +35,11 @@ class ChangelogParser {
     private static final String ITEM_MARK = '    * '
     private static final Pattern ITEM_PATTERN = ~/\[(GROOVY-[0-9]+)\] - (.+)/
     private static final String VERSION_PATTERN = /^((1\.)|[23]\.)/
-    public static final Map<String, String> UNRELEASED = [
-            '1.1.0': 'renamed to 1.5.0',
-            '1.9.0': 'renamed to 2.0.0',
-            '2.6.0': 'discontinued',
-            '3.0.0': 'upcoming new release',
+    public static final Map<String, String> INFO = [
+            '1.1.0': 'Unreleased: renamed to 1.5.0',
+            '1.9.0': 'Unreleased: renamed to 2.0.0',
+            '2.6.0': 'Unreleased: discontinued',
+            '3.0.0': 'Unreleased: upcoming new release',
     ]
 
     static List<Changelog> fetchReleaseNotes(File cacheDirectory) {
@@ -49,7 +49,9 @@ class ChangelogParser {
             it.name =~ VERSION_PATTERN &&
                     it.released == true
         }.collectEntries {
-            [fixName(it.name), it.id]
+            def name = fixName(it.name)
+            INFO[name] = "Released: $it.releaseDate"
+            [name, it.id]
         }
 
         def raw = versionMap.collect { name, id ->
@@ -79,7 +81,7 @@ class ChangelogParser {
         def allMajor = changelogs.groupBy {
             def v = it.groovyVersion
             v.contains('-')?v-v.substring(v.indexOf('-')):v
-        }.findAll { ver, logs -> ver in releasedVersions || ver in UNRELEASED.keySet()
} // add some unreleased versions to get aggregate changelog
+        }.findAll { ver, logs -> ver in releasedVersions || ver in INFO.keySet() } //
add some unreleased versions to get aggregate changelog
         allMajor.collect { k,v ->
             def changelog = changelogs.find { it.groovyVersion == k }
             if (!changelog) {
diff --git a/site/src/site/pages/changelogs.groovy b/site/src/site/pages/changelogs.groovy
index caf9f52..ff98daa 100644
--- a/site/src/site/pages/changelogs.groovy
+++ b/site/src/site/pages/changelogs.groovy
@@ -28,15 +28,17 @@ layout 'layouts/main.groovy', true,
                                 a(name: "changelog$mj") {}
                                 h2("Groovy $mj")
                                 ul {
-                                    minor.each { v ->
+                                    minor.sort{ a, b ->
+                                            aInfo = generator.ChangelogParser.INFO[a]
+                                            bInfo = generator.ChangelogParser.INFO[b]
+                                            (bInfo ? bInfo.split(' ')[-1] : '~') <=>
(aInfo ? aInfo.split(' ')[-1] : '~')
+                                    }.each { v ->
                                         def unreleased = v.endsWith('-unreleased')
                                         def ver = unreleased ? v - '-unreleased' : v
                                         li {
                                             yieldUnescaped ( v.endsWith('-unreleased') ||
(!v.contains('-') && versions.any{ it.startsWith("$v-") }) ? "Aggregate c" : "C" )
+ "hangelog for "
                                             a(href: "changelogs/changelog-${v}.html", "Groovy
$ver")
-                                            if (unreleased) {
-                                                yieldUnescaped "&nbsp;&nbsp;[Unreleased:
${generator.ChangelogParser.UNRELEASED[ver]}]"
-                                            }
+                                            yieldUnescaped "&nbsp;&nbsp;[${generator.ChangelogParser.INFO[ver]}]"
                                         }
                                     }
                                 }


Mime
View raw message