@@ -76,9 +76,6 @@ component {
76
76
// checksums
77
77
buildChecksums ();
78
78
79
- // Build latest changelog
80
- latestChangelog ();
81
-
82
79
// Finalize Message
83
80
print
84
81
.line ()
@@ -130,9 +127,7 @@ component {
130
127
)
131
128
.toConsole ();
132
129
133
- // Prepare exports directory
134
- variables .exportsDir = variables .artifactsDir & " /#projectName #/#arguments .version #" ;
135
- directoryCreate ( variables .exportsDir , true , true );
130
+ ensureExportDir ( argumentCollection = arguments );
136
131
137
132
// Project Build Dir
138
133
variables .projectBuildDir = variables .buildDir & " /#projectName #" ;
@@ -200,11 +195,12 @@ component {
200
195
version = " 1.0.0" ,
201
196
outputDir = " .tmp/apidocs"
202
197
){
198
+ ensureExportDir ( argumentCollection = arguments );
199
+
203
200
// Create project mapping
204
201
fileSystemUtil .createMapping ( arguments .projectName , variables .cwd );
205
202
// Generate Docs
206
203
print .greenLine ( " Generating API Docs, please wait..." ).toConsole ();
207
- directoryCreate ( arguments .outputDir , true , true );
208
204
209
205
command ( " docbox generate" )
210
206
.params (
@@ -228,27 +224,6 @@ component {
228
224
);
229
225
}
230
226
231
- /**
232
- * Build the latest changelog file: changelog-latest.md
233
- */
234
- function latestChangelog (){
235
- print .blueLine ( " Building latest changelog..." ).toConsole ();
236
-
237
- if ( ! fileExists ( variables .cwd & " changelog.md" ) ) {
238
- return error ( " Cannot continue building, changelog.md file doesn't exist!" );
239
- }
240
-
241
- fileWrite (
242
- variables .cwd & " changelog-latest.md" ,
243
- fileRead ( variables .cwd & " changelog.md" ).split ( " ----" )[ 2 ].trim () & chr ( 13 ) & chr ( 10 )
244
- );
245
-
246
- print
247
- .greenLine ( " Latest changelog file created at `changelog-latest.md`" )
248
- .line ()
249
- .line ( fileRead ( variables .cwd & " changelog-latest.md" ) );
250
- }
251
-
252
227
/* ******************************************** PRIVATE HELPERS *********************************************/
253
228
254
229
/**
@@ -315,4 +290,18 @@ component {
315
290
return ( createObject ( " java" , " java.lang.System" ).getProperty ( " cfml.cli.exitCode" ) ?: 0 );
316
291
}
317
292
293
+ /**
294
+ * Ensure the export directory exists at artifacts/NAME/VERSION/
295
+ */
296
+ private function ensureExportDir (
297
+ required projectName ,
298
+ version = " 1.0.0"
299
+ ){
300
+ if ( structKeyExists ( variables , " exportsDir" ) && directoryExists ( variables .exportsDir ) ){
301
+ return ;
302
+ }
303
+ // Prepare exports directory
304
+ variables .exportsDir = variables .artifactsDir & " /#projectName #/#arguments .version #" ;
305
+ directoryCreate ( variables .exportsDir , true , true );
306
+ }
318
307
}
0 commit comments