@@ -56,7 +56,8 @@ task removeDocNav() {
5656 description ' Deletes specific lines in _data/naviation.yml'
5757 File nav = file(' site-source/_data/navigation.yml' )
5858 String fullNav = nav. getText()
59- String removedNav = fullNav. replaceAll(/ (?m)# @xp:start$\s ^docs-xp:$\s (^[\D\d ]*$\s )*^# @xp:end/ , " # @xp:start\n docs-xp:\n # @xp:end" )
59+ String removedNav = fullNav
60+ .replaceAll(/ (?m)# @xp:start$\s (^[\D\d ]*$\s )*^# @xp:end/ , " # @xp:toc" )
6061 nav. setText(removedNav)
6162 }
6263}
@@ -79,14 +80,14 @@ task clean {
7980// CREATE
8081// ------
8182
82- task copyProjectPage (type : Copy ) {
83+ task copyPioneerProjectPage (type : Copy ) {
8384 from ' junit-pioneer/docs/'
8485 include ' project-page.*'
8586 rename ' project-page.adoc' , ' xp.adoc'
8687 into ' site-source/_pages'
8788}
8889
89- task copyDocs (type : Copy ) {
90+ task copyPioneerDocs (type : Copy ) {
9091 from ' junit-pioneer/docs'
9192 exclude ' project-page.*' , ' docs-nav.yml' , ' project-logo.jpg'
9293 into ' site-source/_docs/xp'
@@ -95,28 +96,35 @@ task copyDocs(type: Copy) {
9596task insertDocNav () {
9697 doLast {
9798 description ' Inserts specific lines into _data/naviation.yml'
98- String navContent = file(' junit-pioneer/docs/docs-nav.yml' ). getText()
9999 File navTarget = file(' site-source/_data/navigation.yml' )
100100 String emptyNav = navTarget. getText()
101- String fullNav = emptyNav. replaceAll(/ (?m)# @xp:start$\s ^docs-xp:$\s ^# @xp:end/ , " # @xp:start\n docs-xp:\n ${ navContent} # @xp:end" )
101+
102+ String xpNavContent = file(' junit-pioneer/docs/docs-nav.yml' ). getText()
103+ String fullNav = emptyNav
104+ .replaceAll(/ (?m)# @xp:toc/ , " # @xp:start\n ${ xpNavContent} # @xp:end" )
105+
102106 navTarget. setText(fullNav)
103107 }
104108}
105109
106110task insertVersion () {
107- dependsOn copyProjectPage
111+ dependsOn copyPioneerProjectPage
108112 doLast {
109- description ' Inserts current XP version into XP about page'
110- Properties properties = new Properties ()
111- file(' junit-pioneer/version.properties' ). withInputStream { properties. load(it) }
112- String version = properties. previousVersion
113- File aboutXp = file(' site-source/_pages/xp.adoc' )
114- String aboutXpText = aboutXp. getText()
115- String aboutXpTextWithVersion = aboutXpText. replaceAll(/ @xp:version/ , version)
116- aboutXp. setText(aboutXpTextWithVersion)
113+ description ' Inserts current versions into about pages'
114+ insertProjectVersion(' junit-pioneer' , ' xp' )
117115 }
118116}
119117
118+ def insertProjectVersion (String project , String abbreviation ) {
119+ Properties properties = new Properties ()
120+ file(" ${ project} /version.properties" ). withInputStream { properties. load(it) }
121+ String version = properties. previousVersion
122+ File about = file(" site-source/_pages/${ abbreviation} .adoc" )
123+ String aboutText = about. getText()
124+ String aboutTextWithVersion = aboutText. replaceAll(" @${ abbreviation} :version" , version)
125+ about. setText(aboutTextWithVersion)
126+ }
127+
120128task insertXpIntoHome () {
121129 dependsOn insertVersion
122130 doLast {
@@ -131,7 +139,7 @@ task insertXpIntoHome() {
131139}
132140
133141task create {
134- dependsOn copyProjectPage, copyDocs , insertDocNav, insertVersion, insertXpIntoHome
142+ dependsOn copyPioneerProjectPage, copyPioneerDocs , insertDocNav, insertVersion, insertXpIntoHome
135143}
136144
137145// -----
0 commit comments