Skip to content

Commit ad67525

Browse files
author
Nicolai Parlog
committed
Show current version on landing page (#9)
1 parent d77047c commit ad67525

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

build.gradle

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,18 @@ task removeDocNav() {
6161
}
6262
}
6363

64+
task removeVersion() {
65+
doLast {
66+
description 'Removes current version from site-source/_pages/home.md'
67+
File home = file('site-source/_pages/home.md')
68+
String homeText = home.getText()
69+
String homeTextWithVersion = homeText.replaceAll(/`org.junit-pioneer : junit-pioneer : [^`]*`/, "`org.junit-pioneer : junit-pioneer : @xp:version`")
70+
home.setText(homeTextWithVersion)
71+
}
72+
}
73+
6474
task clean {
65-
dependsOn removeProjectPage, removeDocs, removeDocNav
75+
dependsOn removeProjectPage, removeDocs, removeDocNav, removeVersion
6676
}
6777

6878
// ------
@@ -93,8 +103,21 @@ task insertDocNav() {
93103
}
94104
}
95105

106+
task insertVersion() {
107+
doLast {
108+
description 'Inserts current XP version into site-source/_pages/home.md'
109+
Properties properties = new Properties()
110+
file('junit-pioneer/version.properties').withInputStream { properties.load(it) }
111+
String version = properties.previousVersion
112+
File home = file('site-source/_pages/home.md')
113+
String homeText = home.getText()
114+
String homeTextWithVersion = homeText.replaceAll(/@xp:version/, "${version}")
115+
home.setText(homeTextWithVersion)
116+
}
117+
}
118+
96119
task create {
97-
dependsOn copyProjectPage, copyDocs, insertDocNav
120+
dependsOn copyProjectPage, copyDocs, insertDocNav, insertVersion
98121
}
99122

100123
// -----

0 commit comments

Comments
 (0)