diff --git a/build/Build.cfc b/build/Build.cfc index 3117edb..1376abf 100644 --- a/build/Build.cfc +++ b/build/Build.cfc @@ -27,7 +27,10 @@ component { ]; // Cleanup + Init Build Directories - [ variables.buildDir, variables.artifactsDir ].each( function( item ){ + [ + variables.buildDir, + variables.artifactsDir + ].each( function( item ){ if ( directoryExists( item ) ) { directoryDelete( item, true ); } @@ -132,11 +135,18 @@ component { // Project Build Dir variables.projectBuildDir = variables.buildDir & "/#projectName#"; - directoryCreate( variables.projectBuildDir, true, true ); + directoryCreate( + variables.projectBuildDir, + true, + true + ); // Copy source print.blueLine( "Copying source to build folder..." ).toConsole(); - copy( variables.cwd, variables.projectBuildDir ); + copy( + variables.cwd, + variables.projectBuildDir + ); // Create build ID fileWrite( @@ -175,7 +185,10 @@ component { ); // Copy box.json for convenience - fileCopy( "#variables.projectBuildDir#/box.json", variables.exportsDir ); + fileCopy( + "#variables.projectBuildDir#/box.json", + variables.exportsDir + ); } /** @@ -285,7 +298,10 @@ component { /** * Ensure the export directory exists at artifacts/NAME/VERSION/ */ - private function ensureExportDir( required projectName, version = "1.0.0" ){ + private function ensureExportDir( + required projectName, + version = "1.0.0" + ){ if ( structKeyExists( variables, "exportsDir" ) && directoryExists( variables.exportsDir ) ) { return; } diff --git a/commands/coldbox/create/app-wizard.cfc b/commands/coldbox/create/app-wizard.cfc index 6154586..df9586c 100644 --- a/commands/coldbox/create/app-wizard.cfc +++ b/commands/coldbox/create/app-wizard.cfc @@ -107,9 +107,7 @@ component extends="app" aliases="" { print.boldgreenline( ".env is a module that creates a local variables that can be" ); print.greenline( "used in many places such as .cfconfig.json, box.json, Coldbox.cfc, etc." ); print.greenline( "You will see these used in the template in some of the files above" ); - print.greenline( - "ex. ""${DB_DATABASE}"" or getSystemSetting( ""APPNAME"", ""Your app name here"" )" - ); + print.greenline( "ex. ""${DB_DATABASE}"" or getSystemSetting( ""APPNAME"", ""Your app name here"" )" ); print.greenline( "More info at https://github.com/commandbox-modules/commandbox-dotenv" ); print.boldgreenline( "----------------------------------------------------------------------------------------" diff --git a/commands/coldbox/create/bdd.cfc b/commands/coldbox/create/bdd.cfc index 59e0bdf..de4bcbd 100644 --- a/commands/coldbox/create/bdd.cfc +++ b/commands/coldbox/create/bdd.cfc @@ -21,9 +21,7 @@ component { directory = "tests/specs" ){ // proxy to testbox - runCommand( - "testbox create bdd name=#arguments.name# directory=#arguments.directory# open=#arguments.open#" - ); + runCommand( "testbox create bdd name=#arguments.name# directory=#arguments.directory# open=#arguments.open#" ); } } diff --git a/commands/coldbox/create/handler.cfc b/commands/coldbox/create/handler.cfc index 854c3ea..a3ff433 100644 --- a/commands/coldbox/create/handler.cfc +++ b/commands/coldbox/create/handler.cfc @@ -128,8 +128,18 @@ component aliases="coldbox create controller" extends="coldbox-cli.models.BaseCo "all" ); } else { - handlerContent = replaceNoCase( handlerContent, "|EventActions|", "", "all" ); - handlerTestContent = replaceNoCase( handlerTestContent, "|TestCases|", "", "all" ); + handlerContent = replaceNoCase( + handlerContent, + "|EventActions|", + "", + "all" + ); + handlerTestContent = replaceNoCase( + handlerTestContent, + "|TestCases|", + "", + "all" + ); } // Create dir if it doesn't exist @@ -158,7 +168,11 @@ component aliases="coldbox create controller" extends="coldbox-cli.models.BaseCo if ( arguments.integrationTests ) { var testPath = resolvePath( "#arguments.testsDirectory#/#arguments.name#Test.cfc" ); // Create dir if it doesn't exist - directoryCreate( getDirectoryFromPath( testPath ), true, true ); + directoryCreate( + getDirectoryFromPath( testPath ), + true, + true + ); // Create the tests file action="write" file="#testPath#" mode="777" output="#handlerTestContent#"; printInfo( "Created Integration Spec [#testPath#]" ); @@ -198,9 +212,7 @@ component aliases="coldbox create controller" extends="coldbox-cli.models.BaseCo var actionContent = fileRead( arguments.rest ? "#variables.settings.templatesPath#/RestActionContent.txt" : "#variables.settings.templatesPath#/ActionContent.txt" ); - var handlerTestCaseContent = fileRead( - "#variables.settings.templatesPath#/testing/HandlerBDDCaseContent.txt" - ); + var handlerTestCaseContent = fileRead( "#variables.settings.templatesPath#/testing/HandlerBDDCaseContent.txt" ); // Loop Over actions generating their functions for ( var thisAction in listToArray( arguments.actions ) ) { @@ -213,10 +225,12 @@ component aliases="coldbox create controller" extends="coldbox-cli.models.BaseCo "all" ); // Action Replacement - results.actions = replaceNoCase( results.actions, "|action|", thisAction, "all" ) & repeatString( - variables.cr, - 1 - ); + results.actions = replaceNoCase( + results.actions, + "|action|", + thisAction, + "all" + ) & repeatString( variables.cr, 1 ); // Are we creating views? But only if we are NOT in rest mode if ( arguments.views && !arguments.rest && !listFindNoCase( "create,update,delete", thisAction ) ) { diff --git a/commands/coldbox/create/help.cfc b/commands/coldbox/create/help.cfc index 67cb0e4..28d5a35 100644 --- a/commands/coldbox/create/help.cfc +++ b/commands/coldbox/create/help.cfc @@ -10,9 +10,7 @@ component excludeFromHelp=true { .blue( "as you plan your application. Most commands create a single file, but """ ) .boldblue( "coldbox create app" ) .blueLine( """" ) - .blueLine( - "will generate an entire, working application into an empty folder for you. Type help before" - ) + .blueLine( "will generate an entire, working application into an empty folder for you. Type help before" ) .blueLine( "any command name to get additional information on how to call that specific command." ) .line() .line(); diff --git a/commands/coldbox/create/integration-test.cfc b/commands/coldbox/create/integration-test.cfc index c7ab39d..cfc5d46 100644 --- a/commands/coldbox/create/integration-test.cfc +++ b/commands/coldbox/create/integration-test.cfc @@ -117,7 +117,12 @@ component extends="coldbox-cli.models.BaseCommand" { "all" ); } else { - handlerTestContent = replaceNoCase( handlerTestContent, "|TestCases|", "", "all" ); + handlerTestContent = replaceNoCase( + handlerTestContent, + "|TestCases|", + "", + "all" + ); } var integrationTestPath = "#arguments.directory#/#arguments.handler#Test.cfc"; diff --git a/commands/coldbox/create/interceptor-test.cfc b/commands/coldbox/create/interceptor-test.cfc index 659282d..95c94db 100644 --- a/commands/coldbox/create/interceptor-test.cfc +++ b/commands/coldbox/create/interceptor-test.cfc @@ -32,12 +32,8 @@ component extends="coldbox-cli.models.BaseCommand" { } // Read in Template - var interceptorTestContent = fileRead( - "#variables.settings.templatesPath#/testing/InterceptorBDDContent.txt" - ); - var interceptorTestCase = fileRead( - "#variables.settings.templatesPath#/testing/InterceptorBDDCaseContent.txt" - ); + var interceptorTestContent = fileRead( "#variables.settings.templatesPath#/testing/InterceptorBDDContent.txt" ); + var interceptorTestCase = fileRead( "#variables.settings.templatesPath#/testing/InterceptorBDDCaseContent.txt" ); // Start Replacing interceptorTestContent = replaceNoCase( @@ -79,7 +75,11 @@ component extends="coldbox-cli.models.BaseCommand" { // Write it out. var testPath = "#arguments.testsDirectory#/#listLast( arguments.path, "." )#Test.cfc"; // Create dir if it doesn't exist - directoryCreate( getDirectoryFromPath( testPath ), true, true ); + directoryCreate( + getDirectoryFromPath( testPath ), + true, + true + ); // Confirm it if ( diff --git a/commands/coldbox/create/interceptor.cfc b/commands/coldbox/create/interceptor.cfc index e072c0b..2400a6e 100644 --- a/commands/coldbox/create/interceptor.cfc +++ b/commands/coldbox/create/interceptor.cfc @@ -48,12 +48,8 @@ component extends="coldbox-cli.models.BaseCommand" { // Read in Template var interceptorContent = fileRead( "#variables.settings.templatesPath#/InterceptorContent.txt" ); var interceptorMethod = fileRead( "#variables.settings.templatesPath#/InterceptorMethod.txt" ); - var interceptorTestContent = fileRead( - "#variables.settings.templatesPath#/testing/InterceptorBDDContent.txt" - ); - var interceptorTestCase = fileRead( - "#variables.settings.templatesPath#/testing/InterceptorBDDCaseContent.txt" - ); + var interceptorTestContent = fileRead( "#variables.settings.templatesPath#/testing/InterceptorBDDContent.txt" ); + var interceptorTestCase = fileRead( "#variables.settings.templatesPath#/testing/InterceptorBDDCaseContent.txt" ); // Start Replacing interceptorContent = replaceNoCase( @@ -149,7 +145,11 @@ component extends="coldbox-cli.models.BaseCommand" { if ( tests ) { var testPath = "#TestsDirectory#/#arguments.name#Test.cfc"; // Create dir if it doesn't exist - directoryCreate( getDirectoryFromPath( testPath ), true, true ); + directoryCreate( + getDirectoryFromPath( testPath ), + true, + true + ); // Create the tests file action="write" file="#testPath#" mode="777" output="#interceptorTestContent#"; printInfo( "Created #testPath#" ); diff --git a/commands/coldbox/create/model-test.cfc b/commands/coldbox/create/model-test.cfc index 8903e2c..dae3493 100644 --- a/commands/coldbox/create/model-test.cfc +++ b/commands/coldbox/create/model-test.cfc @@ -45,9 +45,7 @@ component extends="coldbox-cli.models.BaseCommand" { // Read in Template var modelTestContent = fileRead( "#variables.settings.templatesPath#/testing/ModelBDDContent.txt" ); - var modelTestMethodContent = fileRead( - "#variables.settings.templatesPath#/testing/ModelBDDMethodContent.txt" - ); + var modelTestMethodContent = fileRead( "#variables.settings.templatesPath#/testing/ModelBDDMethodContent.txt" ); // Basic replacements modelTestContent = replaceNoCase( @@ -90,12 +88,21 @@ component extends="coldbox-cli.models.BaseCommand" { "all" ); } else { - modelTestContent = replaceNoCase( modelTestContent, "|TestCases|", "", "all" ); + modelTestContent = replaceNoCase( + modelTestContent, + "|TestCases|", + "", + "all" + ); } var testPath = "#arguments.TestsDirectory#/#listLast( arguments.path, "." )#Test.cfc"; // Create dir if it doesn't exist - directoryCreate( getDirectoryFromPath( testPath ), true, true ); + directoryCreate( + getDirectoryFromPath( testPath ), + true, + true + ); // Confirm it if ( diff --git a/commands/coldbox/create/model.cfc b/commands/coldbox/create/model.cfc index 3e3e619..334d05d 100644 --- a/commands/coldbox/create/model.cfc +++ b/commands/coldbox/create/model.cfc @@ -101,9 +101,18 @@ component extends="coldbox-cli.models.BaseCommand" { error( "Cannot scaffold a model with an empty name." ); } // Validate persistence - if ( !listFindNoCase( variables.validPersistences, arguments.persistence ) ) { + if ( + !listFindNoCase( + variables.validPersistences, + arguments.persistence + ) + ) { error( - "The persistence value [#arguments.persistence#] is invalid. Valid values are [#listChangeDelims( variables.validPersistences, ", ", "," )#]" + "The persistence value [#arguments.persistence#] is invalid. Valid values are [#listChangeDelims( + variables.validPersistences, + ", ", + "," + )#]" ); } // Exit the command if something above failed @@ -118,9 +127,7 @@ component extends="coldbox-cli.models.BaseCommand" { var modelContent = fileRead( "#variables.settings.templatesPath#/ModelContent.txt" ); var modelMethodContent = fileRead( "#variables.settings.templatesPath#/ModelMethodContent.txt" ); var modelTestContent = fileRead( "#variables.settings.templatesPath#/testing/ModelBDDContent.txt" ); - var modelTestMethodContent = fileRead( - "#variables.settings.templatesPath#/testing/ModelBDDMethodContent.txt" - ); + var modelTestMethodContent = fileRead( "#variables.settings.templatesPath#/testing/ModelBDDMethodContent.txt" ); // Basic replacements modelContent = replaceNoCase( @@ -163,7 +170,12 @@ component extends="coldbox-cli.models.BaseCommand" { // Persistence switch ( Persistence ) { case "Transient": - modelContent = replaceNoCase( modelContent, "|modelPersistence|", "", "all" ); + modelContent = replaceNoCase( + modelContent, + "|modelPersistence|", + "", + "all" + ); break; case "Singleton": modelContent = replaceNoCase( @@ -183,7 +195,12 @@ component extends="coldbox-cli.models.BaseCommand" { "all" ); } else { - modelContent = replaceNoCase( modelContent, "|accessors|", "", "all" ); + modelContent = replaceNoCase( + modelContent, + "|accessors|", + "", + "all" + ); } // Generate Model Properties @@ -240,7 +257,12 @@ component extends="coldbox-cli.models.BaseCommand" { } // final replacement - modelContent = replaceNoCase( modelContent, "|methods|", allMethods, "all" ); + modelContent = replaceNoCase( + modelContent, + "|methods|", + allMethods, + "all" + ); modelTestContent = replaceNoCase( modelTestContent, "|TestCases|", @@ -249,13 +271,22 @@ component extends="coldbox-cli.models.BaseCommand" { ); } else { modelContent = replaceNoCase( modelContent, "|methods|", "", "all" ); - modelTestContent = replaceNoCase( modelTestContent, "|TestCases|", "", "all" ); + modelTestContent = replaceNoCase( + modelTestContent, + "|TestCases|", + "", + "all" + ); } // Write out the model var modelPath = "#arguments.directory#/#arguments.name#.cfc"; // Create dir if it doesn't exist - directoryCreate( getDirectoryFromPath( modelPath ), true, true ); + directoryCreate( + getDirectoryFromPath( modelPath ), + true, + true + ); // Prompt for override if ( @@ -324,7 +355,11 @@ component extends="coldbox-cli.models.BaseCommand" { "all" ); // Create dir if it doesn't exist - directoryCreate( getDirectoryFromPath( seederPath ), true, true ); + directoryCreate( + getDirectoryFromPath( seederPath ), + true, + true + ); // Create the migration file action="write" file="#seederPath#" mode="777" output="#seedContent#"; // open file diff --git a/commands/coldbox/create/module.cfc b/commands/coldbox/create/module.cfc index b5f684b..fecdc19 100644 --- a/commands/coldbox/create/module.cfc +++ b/commands/coldbox/create/module.cfc @@ -45,7 +45,12 @@ component extends="coldbox-cli.models.BaseCommand" { var moduleConfig = fileRead( "#variables.settings.templatesPath#/modules/ModuleConfig.cfc" ); // Start Generation Replacing - moduleConfig = replaceNoCase( moduleConfig, "@title@", arguments.name, "all" ); + moduleConfig = replaceNoCase( + moduleConfig, + "@title@", + arguments.name, + "all" + ); moduleConfig = replaceNoCase( moduleConfig, "@author@", @@ -107,11 +112,17 @@ component extends="coldbox-cli.models.BaseCommand" { // Remove or keep Views? if ( !arguments.views ) { - directoryDelete( arguments.directory & "/#arguments.name#/views", true ); + directoryDelete( + arguments.directory & "/#arguments.name#/views", + true + ); } // Write Out the New Config - fileWrite( arguments.directory & "/#arguments.name#/ModuleConfig.cfc", moduleConfig ); + fileWrite( + arguments.directory & "/#arguments.name#/ModuleConfig.cfc", + moduleConfig + ); // Output printInfo( "Created Module (#arguments.name#) -> [#arguments.directory#]" ); diff --git a/commands/coldbox/create/orm-crud.cfc b/commands/coldbox/create/orm-crud.cfc index 82cb2c6..27a2d01 100644 --- a/commands/coldbox/create/orm-crud.cfc +++ b/commands/coldbox/create/orm-crud.cfc @@ -33,9 +33,7 @@ component extends="coldbox-cli.models.BaseCommand" { // entity defaults var entityName = listLast( arguments.entity, "." ); - var entityCFC = fileSystemUtil.makePathRelative( - resolvePath( replace( arguments.entity, ".", "/", "all" ) ) - ); + var entityCFC = fileSystemUtil.makePathRelative( resolvePath( replace( arguments.entity, ".", "/", "all" ) ) ); var entityPath = entityCFC & ".cfc"; // verify it @@ -75,8 +73,13 @@ component extends="coldbox-cli.models.BaseCommand" { // Read Handler Content var hContent = fileRead( "#variables.settings.templatePath#/crud/HandlerContent.txt" ); // Token replacement - hContent = replaceNoCase( hContent, "|entity|", entityName, "all" ); hContent = replaceNoCase( + hContent, + "|entity|", + entityName, + "all" + ); + hContent = replaceNoCase( hContent, "|entityPlural|", arguments.pluralName, @@ -87,7 +90,11 @@ component extends="coldbox-cli.models.BaseCommand" { // Write Out Handler var hpath = "#arguments.handlersDirectory#/#arguments.pluralName#.cfc"; // Create dir if it doesn't exist - directoryCreate( getDirectoryFromPath( hpath ), true, true ); + directoryCreate( + getDirectoryFromPath( hpath ), + true, + true + ); file action="write" file="#hpath#" mode="777" output="#hContent#"; printInfo( "Generated Handler: [#hPath#]" ); @@ -102,17 +109,23 @@ component extends="coldbox-cli.models.BaseCommand" { var views = [ "edit", "editor", "new" ]; for ( var thisView in views ) { var vContent = fileRead( "#variables.settings.templatePath#/crud/#thisView#.txt" ); - vContent = replaceNoCase( vContent, "|entity|", entityName, "all" ); vContent = replaceNoCase( + vContent, + "|entity|", + entityName, + "all" + ); + vContent = replaceNoCase( vContent, "|entityPlural|", arguments.pluralName, "all" ); - fileWrite( arguments.viewsDirectory & "/#arguments.pluralName#/#thisView#.cfm", vContent ); - printInfo( - "Generated View: [" & arguments.viewsDirectory & "/#arguments.pluralName#/#thisView#.cfm]" + fileWrite( + arguments.viewsDirectory & "/#arguments.pluralName#/#thisView#.cfm", + vContent ); + printInfo( "Generated View: [" & arguments.viewsDirectory & "/#arguments.pluralName#/#thisView#.cfm]" ); } // ********************** generate table output ************************************// @@ -121,19 +134,42 @@ component extends="coldbox-cli.models.BaseCommand" { savecontent variable="local.tableData" { include "#variables.settings.templatePath#/crud/table.cfm"; } - tableData = replaceNoCase( tableData, "%cf", "#chr( 60 )#cf", "all" ); - tableData = replaceNoCase( tableData, "%/cf", "#chr( 60 )#/cf", "all" ); + tableData = replaceNoCase( + tableData, + "%cf", + "#chr( 60 )#cf", + "all" + ); + tableData = replaceNoCase( + tableData, + "%/cf", + "#chr( 60 )#/cf", + "all" + ); // index data var vContent = fileRead( "#variables.settings.templatePath#/crud/index.txt" ); - vContent = replaceNoCase( vContent, "|entity|", entityName, "all" ); vContent = replaceNoCase( + vContent, + "|entity|", + entityName, + "all" + ); + vContent = replaceNoCase( vContent, "|entityPlural|", arguments.pluralName, "all" ); - vContent = replaceNoCase( vContent, "|tableListing|", tableData, "all" ); - fileWrite( arguments.viewsDirectory & "/#arguments.pluralName#/index.cfm", vContent ); + vContent = replaceNoCase( + vContent, + "|tableListing|", + tableData, + "all" + ); + fileWrite( + arguments.viewsDirectory & "/#arguments.pluralName#/index.cfm", + vContent + ); printInfo( "Generated View: [" & arguments.viewsDirectory & "/#arguments.pluralName#/index.cfm]" ); } else { return error( "The entity: #entityName# has no properties, so I have no clue what to CRUD on dude!" ); diff --git a/commands/coldbox/create/orm-event-handler.cfc b/commands/coldbox/create/orm-event-handler.cfc index 8373271..87d5489 100644 --- a/commands/coldbox/create/orm-event-handler.cfc +++ b/commands/coldbox/create/orm-event-handler.cfc @@ -37,7 +37,11 @@ component extends="coldbox-cli.models.BaseCommand" { // Write out the model var modelPath = "#directory#/#arguments.name#.cfc"; // Create dir if it doesn't exist - directoryCreate( getDirectoryFromPath( modelPath ), true, true ); + directoryCreate( + getDirectoryFromPath( modelPath ), + true, + true + ); // Prompt for override if ( diff --git a/commands/coldbox/create/orm-service.cfc b/commands/coldbox/create/orm-service.cfc index 1cc88a7..d980558 100644 --- a/commands/coldbox/create/orm-service.cfc +++ b/commands/coldbox/create/orm-service.cfc @@ -82,12 +82,21 @@ component extends="coldbox-cli.models.BaseCommand" { "#nonCanonicalDirectory#.#arguments.serviceName#", "all" ); - modelTestContent = replaceNoCase( modelTestContent, "|TestCases|", "", "all" ); + modelTestContent = replaceNoCase( + modelTestContent, + "|TestCases|", + "", + "all" + ); // Write out the model var modelPath = "#arguments.directory#/#arguments.serviceName#Service.cfc"; // Create dir if it doesn't exist - directoryCreate( getDirectoryFromPath( modelPath ), true, true ); + directoryCreate( + getDirectoryFromPath( modelPath ), + true, + true + ); // Confirm it if ( diff --git a/commands/coldbox/create/orm-virtual-service.cfc b/commands/coldbox/create/orm-virtual-service.cfc index 826f4e8..343f278 100644 --- a/commands/coldbox/create/orm-virtual-service.cfc +++ b/commands/coldbox/create/orm-virtual-service.cfc @@ -82,12 +82,21 @@ component extends="coldbox-cli.models.BaseCommand" { "#nonCanonicalDirectory#.#arguments.entityName#", "all" ); - modelTestContent = replaceNoCase( modelTestContent, "|TestCases|", "", "all" ); + modelTestContent = replaceNoCase( + modelTestContent, + "|TestCases|", + "", + "all" + ); // Write out the model var modelPath = "#arguments.directory#/#arguments.entityName#Service.cfc"; // Create dir if it doesn't exist - directoryCreate( getDirectoryFromPath( modelPath ), true, true ); + directoryCreate( + getDirectoryFromPath( modelPath ), + true, + true + ); // Confirm it if ( @@ -105,7 +114,11 @@ component extends="coldbox-cli.models.BaseCommand" { if ( arguments.tests ) { var testPath = "#arguments.TestsDirectory#/#arguments.entityName#ServiceTest.cfc"; // Create dir if it doesn't exist - directoryCreate( getDirectoryFromPath( testPath ), true, true ); + directoryCreate( + getDirectoryFromPath( testPath ), + true, + true + ); // Create the tests file action="write" file="#testPath#" mode="777" output="#modelTestContent#"; // open file diff --git a/commands/coldbox/create/resource.cfc b/commands/coldbox/create/resource.cfc index 633374f..2aec4d7 100644 --- a/commands/coldbox/create/resource.cfc +++ b/commands/coldbox/create/resource.cfc @@ -38,7 +38,13 @@ component extends="coldbox-cli.models.BaseCommand" { ]; // STATIC Actions we use in the resources - variables.API_ACTIONS = [ "index", "create", "show", "update", "delete" ]; + variables.API_ACTIONS = [ + "index", + "create", + "show", + "update", + "delete" + ]; /** * @resource The name of a single resource or a list of resources to generate @@ -113,7 +119,10 @@ component extends="coldbox-cli.models.BaseCommand" { ) { printInfo( "Generating (#arguments.module#) module..." ); command( "coldbox create module" ) - .params( name = arguments.module, directory = arguments.modulesDirectory ) + .params( + name = arguments.module, + directory = arguments.modulesDirectory + ) .run(); } arguments.handlersDirectory = modulePath & "/" & arguments.handlersDirectory & "/"; @@ -130,9 +139,9 @@ component extends="coldbox-cli.models.BaseCommand" { printInfo( "Generating (#arguments.resource#) resources..." ); // Read in Template - var hContent = arguments.api ? fileRead( - "#variables.settings.templatesPath#/resources/ApiHandlerContent.txt" - ) : fileRead( "#variables.settings.templatesPath#/resources/HandlerContent.txt" ); + var hContent = arguments.api ? fileRead( "#variables.settings.templatesPath#/resources/ApiHandlerContent.txt" ) : fileRead( + "#variables.settings.templatesPath#/resources/HandlerContent.txt" + ); // Token replacement hContent = replaceNoCase( hContent, @@ -165,7 +174,11 @@ component extends="coldbox-cli.models.BaseCommand" { // Write Out Handler var hpath = "#arguments.handlersDirectory#/#arguments.handler#.cfc"; // Create dir if it doesn't exist - directoryCreate( getDirectoryFromPath( hpath ), true, true ); + directoryCreate( + getDirectoryFromPath( hpath ), + true, + true + ); // Confirm it if ( @@ -276,23 +289,15 @@ component extends="coldbox-cli.models.BaseCommand" { var routerCode = "// @app_routes@#variables.utility.BREAK##variables.utility.BREAK#"; if ( arguments.resource == arguments.handler ) { if ( arguments.parameterName == "id" ) { - routerCode &= repeatString( variables.utility.TAB, 2 ) & ( - arguments.api ? "apiResources" : "resources" - ) & "( ""#arguments.resource#"" )"; + routerCode &= repeatString( variables.utility.TAB, 2 ) & ( arguments.api ? "apiResources" : "resources" ) & "( ""#arguments.resource#"" )"; } else { - routerCode &= repeatString( variables.utility.TAB, 2 ) & ( - arguments.api ? "apiResources" : "resources" - ) & "( resource=""#arguments.resource#"", parameterName=""#arguments.parameterName#"" )"; + routerCode &= repeatString( variables.utility.TAB, 2 ) & ( arguments.api ? "apiResources" : "resources" ) & "( resource=""#arguments.resource#"", parameterName=""#arguments.parameterName#"" )"; } } else { if ( arguments.parameterName == "id" ) { - routerCode &= repeatString( variables.utility.TAB, 2 ) & ( - arguments.api ? "apiResources" : "resources" - ) & "( resource=""#arguments.resource#"", handler=""#arguments.handler#"" )"; + routerCode &= repeatString( variables.utility.TAB, 2 ) & ( arguments.api ? "apiResources" : "resources" ) & "( resource=""#arguments.resource#"", handler=""#arguments.handler#"" )"; } else { - routerCode &= repeatString( variables.utility.TAB, 2 ) & ( - arguments.api ? "apiResources" : "resources" - ) & "( resource=""#arguments.resource#"", handler=""#arguments.handler#"", parameterName=""#arguments.parameterName#"" )"; + routerCode &= repeatString( variables.utility.TAB, 2 ) & ( arguments.api ? "apiResources" : "resources" ) & "( resource=""#arguments.resource#"", handler=""#arguments.handler#"", parameterName=""#arguments.parameterName#"" )"; } } diff --git a/commands/coldbox/create/service.cfc b/commands/coldbox/create/service.cfc index 88a4b73..98d869a 100644 --- a/commands/coldbox/create/service.cfc +++ b/commands/coldbox/create/service.cfc @@ -63,9 +63,7 @@ component extends="coldbox-cli.models.BaseCommand" { var modelContent = fileRead( "#variables.settings.templatesPath#/ServiceContent.txt" ); var modelMethodContent = fileRead( "#variables.settings.templatesPath#/ModelMethodContent.txt" ); var modelTestContent = fileRead( "#variables.settings.templatesPath#/testing/ModelBDDContent.txt" ); - var modelTestMethodContent = fileRead( - "#variables.settings.templatesPath#/testing/ModelBDDMethodContent.txt" - ); + var modelTestMethodContent = fileRead( "#variables.settings.templatesPath#/testing/ModelBDDMethodContent.txt" ); // Basic replacements modelContent = replaceNoCase( @@ -140,7 +138,12 @@ component extends="coldbox-cli.models.BaseCommand" { } // final replacement - modelContent = replaceNoCase( modelContent, "|methods|", allMethods, "all" ); + modelContent = replaceNoCase( + modelContent, + "|methods|", + allMethods, + "all" + ); modelTestContent = replaceNoCase( modelTestContent, "|TestCases|", @@ -149,13 +152,22 @@ component extends="coldbox-cli.models.BaseCommand" { ); } else { modelContent = replaceNoCase( modelContent, "|methods|", "", "all" ); - modelTestContent = replaceNoCase( modelTestContent, "|TestCases|", "", "all" ); + modelTestContent = replaceNoCase( + modelTestContent, + "|TestCases|", + "", + "all" + ); } // Write out the model var modelPath = "#arguments.directory#/#arguments.name#.cfc"; // Create dir if it doesn't exist - directoryCreate( getDirectoryFromPath( modelPath ), true, true ); + directoryCreate( + getDirectoryFromPath( modelPath ), + true, + true + ); // Prompt for override if ( diff --git a/commands/coldbox/create/unit.cfc b/commands/coldbox/create/unit.cfc index 5837e05..3c079ef 100644 --- a/commands/coldbox/create/unit.cfc +++ b/commands/coldbox/create/unit.cfc @@ -22,9 +22,7 @@ component { ){ // proxy to testbox // TODO: Migrate this to the `testbox-cli` module. Once that's done, add it as a dependency. - runCommand( - "testbox create unit name=#arguments.name# directory=#arguments.directory# open=#arguments.open#" - ); + runCommand( "testbox create unit name=#arguments.name# directory=#arguments.directory# open=#arguments.open#" ); } } diff --git a/commands/coldbox/reinit.cfc b/commands/coldbox/reinit.cfc index e471ac8..414206c 100644 --- a/commands/coldbox/reinit.cfc +++ b/commands/coldbox/reinit.cfc @@ -21,7 +21,11 @@ component aliases="fwreinit" { * @name Name of the CommandBox server to reinit * @showUrl Show the Url to reinit **/ - function run( password = "1", name = "", showUrl = true ){ + function run( + password = "1", + name = "", + showUrl = true + ){ var serverInfo = serverService.getServerInfoByDiscovery( getCWD(), arguments.name ); if ( !structCount( serverInfo ) ) { diff --git a/commands/coldbox/watch-reinit.cfc b/commands/coldbox/watch-reinit.cfc index b606729..2e225cb 100644 --- a/commands/coldbox/watch-reinit.cfc +++ b/commands/coldbox/watch-reinit.cfc @@ -60,8 +60,11 @@ component { // Determine watching patterns, either from arguments or boxoptions or defaults var globbingPaths = arguments.paths ?: getOptionsWatchers() ?: variables.PATHS; // handle non numeric config and put a floor of 150ms - var delayMs = max( val( arguments.delay ?: boxOptions.reinitWatchDelay ?: variables.WATCH_DELAY ), 150 ); - var statusColors = { + var delayMs = max( + val( arguments.delay ?: boxOptions.reinitWatchDelay ?: variables.WATCH_DELAY ), + 150 + ); + var statusColors = { "added" : "green", "removed" : "red", "changed" : "yellow" @@ -109,8 +112,14 @@ component { changeData[ status ].map( function( filePath ){ print .text( changetime, statusColors[ status ] ) - .text( filePath, statusColors[ status ] & "Bold" ) - .text( " " & status & " ", statusColors[ status ] ) + .text( + filePath, + statusColors[ status ] & "Bold" + ) + .text( + " " & status & " ", + statusColors[ status ] + ) .toConsole(); } ) } diff --git a/models/Utility.cfc b/models/Utility.cfc index a6dd7ee..1f2a560 100644 --- a/models/Utility.cfc +++ b/models/Utility.cfc @@ -45,12 +45,22 @@ component singleton { result &= "s"; } } else if ( result.endsWith( "y" ) ) { - if ( arrayFindNoCase( [ "ay", "ey", "iy", "oy", "uy" ], right( result, 2 ) ) ) { + if ( + arrayFindNoCase( + [ "ay", "ey", "iy", "oy", "uy" ], + right( result, 2 ) + ) + ) { result &= "s"; } else { result = left( result, len( result ) - 1 ) & "ies"; } - } else if ( arrayFindNoCase( [ "x", "s", "z", "ch", "sh" ], right( result, 1 ) ) ) { + } else if ( + arrayFindNoCase( + [ "x", "s", "z", "ch", "sh" ], + right( result, 1 ) + ) + ) { result &= "es"; } else { result &= "s"; @@ -65,10 +75,11 @@ component singleton { * @target The string to camel case * @capitalized Whether or not to capitalize the first letter, default is false */ - function camelCase( required target, boolean capitalized = false ){ - var results = arguments.capitalized ? arguments.target.left( 1 ).ucase() : arguments.target - .left( 1 ) - .lCase(); + function camelCase( + required target, + boolean capitalized = false + ){ + var results = arguments.capitalized ? arguments.target.left( 1 ).ucase() : arguments.target.left( 1 ).lCase(); if ( arguments.target.len() > 1 ) { results &= arguments.target.right( -1 );