Skip to content

Commit b070b77

Browse files
committed
fix changelog build
1 parent 5850cd8 commit b070b77

File tree

1 file changed

+17
-28
lines changed

1 file changed

+17
-28
lines changed

build/Build.cfc

Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,6 @@ component {
7676
// checksums
7777
buildChecksums();
7878

79-
// Build latest changelog
80-
latestChangelog();
81-
8279
// Finalize Message
8380
print
8481
.line()
@@ -130,9 +127,7 @@ component {
130127
)
131128
.toConsole();
132129

133-
// Prepare exports directory
134-
variables.exportsDir = variables.artifactsDir & "/#projectName#/#arguments.version#";
135-
directoryCreate( variables.exportsDir, true, true );
130+
ensureExportDir( argumentCollection = arguments );
136131

137132
// Project Build Dir
138133
variables.projectBuildDir = variables.buildDir & "/#projectName#";
@@ -200,11 +195,12 @@ component {
200195
version = "1.0.0",
201196
outputDir = ".tmp/apidocs"
202197
){
198+
ensureExportDir( argumentCollection = arguments );
199+
203200
// Create project mapping
204201
fileSystemUtil.createMapping( arguments.projectName, variables.cwd );
205202
// Generate Docs
206203
print.greenLine( "Generating API Docs, please wait..." ).toConsole();
207-
directoryCreate( arguments.outputDir, true, true );
208204

209205
command( "docbox generate" )
210206
.params(
@@ -228,27 +224,6 @@ component {
228224
);
229225
}
230226

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-
252227
/********************************************* PRIVATE HELPERS *********************************************/
253228

254229
/**
@@ -315,4 +290,18 @@ component {
315290
return ( createObject( "java", "java.lang.System" ).getProperty( "cfml.cli.exitCode" ) ?: 0 );
316291
}
317292

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+
}
318307
}

0 commit comments

Comments
 (0)