@@ -56,7 +56,8 @@ task removeDocNav() {
56
56
description ' Deletes specific lines in _data/naviation.yml'
57
57
File nav = file(' site-source/_data/navigation.yml' )
58
58
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" )
60
61
nav. setText(removedNav)
61
62
}
62
63
}
@@ -79,14 +80,14 @@ task clean {
79
80
// CREATE
80
81
// ------
81
82
82
- task copyProjectPage (type : Copy ) {
83
+ task copyPioneerProjectPage (type : Copy ) {
83
84
from ' junit-pioneer/docs/'
84
85
include ' project-page.*'
85
86
rename ' project-page.adoc' , ' xp.adoc'
86
87
into ' site-source/_pages'
87
88
}
88
89
89
- task copyDocs (type : Copy ) {
90
+ task copyPioneerDocs (type : Copy ) {
90
91
from ' junit-pioneer/docs'
91
92
exclude ' project-page.*' , ' docs-nav.yml' , ' project-logo.jpg'
92
93
into ' site-source/_docs/xp'
@@ -95,28 +96,35 @@ task copyDocs(type: Copy) {
95
96
task insertDocNav () {
96
97
doLast {
97
98
description ' Inserts specific lines into _data/naviation.yml'
98
- String navContent = file(' junit-pioneer/docs/docs-nav.yml' ). getText()
99
99
File navTarget = file(' site-source/_data/navigation.yml' )
100
100
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
+
102
106
navTarget. setText(fullNav)
103
107
}
104
108
}
105
109
106
110
task insertVersion () {
107
- dependsOn copyProjectPage
111
+ dependsOn copyPioneerProjectPage
108
112
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' )
117
115
}
118
116
}
119
117
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
+
120
128
task insertXpIntoHome () {
121
129
dependsOn insertVersion
122
130
doLast {
@@ -131,7 +139,7 @@ task insertXpIntoHome() {
131
139
}
132
140
133
141
task create {
134
- dependsOn copyProjectPage, copyDocs , insertDocNav, insertVersion, insertXpIntoHome
142
+ dependsOn copyPioneerProjectPage, copyPioneerDocs , insertDocNav, insertVersion, insertXpIntoHome
135
143
}
136
144
137
145
// -----
0 commit comments