From 30d4f7f635ed08f1f4e5d03655b39174b56527b5 Mon Sep 17 00:00:00 2001 From: Github Actions Date: Fri, 19 May 2023 20:36:27 +0000 Subject: [PATCH 01/11] Version bump --- box.json | 2 +- changelog.md | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/box.json b/box.json index 48e271d..c7fd9a9 100644 --- a/box.json +++ b/box.json @@ -1,6 +1,6 @@ { "name":"ColdBox CLI", - "version":"7.2.1", + "version":"7.3.0", "location":"https://downloads.ortussolutions.com/ortussolutions/commandbox-modules/coldbox-cli/@build.version@/coldbox-cli-@build.version@.zip", "slug":"coldbox-cli", "author":"Ortus Solutions, Corp", diff --git a/changelog.md b/changelog.md index e0227a9..24dbd2b 100644 --- a/changelog.md +++ b/changelog.md @@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [7.2.1] - 2023-05-19 + ### Fixed - Fixed `coldbox create layout` failing due to unescpaed `#view()#` command @@ -71,7 +73,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Eclipse support -[Unreleased]: https://github.com/ColdBox/coldbox-cli/compare/v7.2.0...HEAD +[Unreleased]: https://github.com/ColdBox/coldbox-cli/compare/v7.2.1...HEAD + +[7.2.1]: https://github.com/ColdBox/coldbox-cli/compare/v7.2.0...v7.2.1 [7.2.0]: https://github.com/ColdBox/coldbox-cli/compare/v7.1.0...v7.2.0 From 9717ae2b9f2a0a9392d4ae32da7a8373d99aa712 Mon Sep 17 00:00:00 2001 From: Carl Von Stetten Date: Mon, 28 Aug 2023 10:17:12 -0700 Subject: [PATCH 02/11] Fix module.cfc typo Fix typo in run() method javadoc heading --- commands/coldbox/create/module.cfc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/coldbox/create/module.cfc b/commands/coldbox/create/module.cfc index d45cc60..b5f684b 100644 --- a/commands/coldbox/create/module.cfc +++ b/commands/coldbox/create/module.cfc @@ -14,7 +14,7 @@ component extends="coldbox-cli.models.BaseCommand" { * @author Whoever wrote this module * @authorURL The author's URL * @description The description for this module - * @version The semantic version number: major.minior.patch + * @version The semantic version number: major.minor.patch * @cfmapping A CF app mapping to create that points to the root of this module * @modelNamespace The namespace to use when mapping the models in this module * @dependencies The list of dependencies for this module From 2d409a4a825bb090ebc34acd957ddd1e25c03c76 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Thu, 14 Dec 2023 14:45:04 +0100 Subject: [PATCH 03/11] improved ignopres --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 227dcd2..8a63cac 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ # Dependencies /docbox/** +modules/** # Build Artifacts .tmp/** From 65ebbc7474188d8e0615da0cd8818f9bfc6d3964 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Thu, 14 Dec 2023 14:47:58 +0100 Subject: [PATCH 04/11] added contriobs --- CONTRIBUTING.md | 108 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..ad18080 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,108 @@ +# Contributing Guide + +Hola amigo! I'm really excited that you are interested in contributing to coldbox-cli. Before submitting your contribution, please make sure to take a moment and read through the following guidelines: + +- [Code Of Conduct](#code-of-conduct) +- [Bug Reporting](#bug-reporting) +- [Support Questions](#support-questions) +- [Pull Request Guidelines](#pull-request-guidelines) +- [Security Vulnerabilities](#security-vulnerabilities) +- [Development Setup](#development-setup) +- [Language Compatibility](#language-compatibility) +- [Coding Styles \& Formatting](#coding-styles--formatting) +- [CFC Docs With DocBox](#cfc-docs-with-docbox) +- [Financial Contributions](#financial-contributions) +- [Contributors](#contributors) + +## Code Of Conduct + +This project is open source, and as such, the maintainers give their free time to build and maintain the source code held within. They make the code freely available in the hope that it will be of use to other developers and/or businesses. Please be considerate towards maintainers when raising issues or presenting pull requests. **We all follow the Golden Rule: Do to others as you want them to do to you.** + +- As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities. +- Participants will be tolerant of opposing views. +- Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct. +- Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned with this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team. +- When interpreting the words and actions of others, participants should always assume good intentions. Emotions cannot be derived from textual representations. +- Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers. + + +## Bug Reporting + +Please make sure also that if you submit a pull request, you link it to the appropriate issue(s). + +If you file a bug report, your issue should contain a title, a clear description of the issue, a way to replicate the issue, and any support files that we might need to replicate your issue. The goal of a bug report is to make it easy for yourself - and others - to replicate the bug and develop a fix for it. All issues that do not contain a way to replicate will not be addressed. + +## Support Questions + +If you have any questions on usage, professional support or just ideas to bounce off the maintainers, please do not create an issue. Leverage our support channels first. + +- Ortus Community Discourse: https://community.ortussolutions.com +- Box Slack Team: http://boxteam.ortussolutions.com/ +- Professional Support: https://www.ortussolutions.com/services/support + +## Pull Request Guidelines + +- The `(master|main)` branch is just a snapshot of the latest stable release. All development should be done in dedicated branches. Do not submit PRs against the master branch. They will be closed. +- All pull requests should be sent to the `development` branch or the appropriate LTS branch (`releases/v{version}`). +- It's OK to have multiple small commits as you work on the PR - GitHub will automatically squash it before merging. +- Make sure all local tests pass before submitting the merge. +- Please make sure all your pull requests have companion tests. +- Please link the Jira issue in your PR title when sending the final PR + +## Security Vulnerabilities + +If you discover a security vulnerability, please send an email to the Ortus security team at [security@ortussolutions.com](mailto:security@ortussolutions.com?subject=security) and make sure you report it to the `#security` channel in our Box Team Slack Channel. All security vulnerabilities will be promptly addressed. + +## Development Setup + +1. Fork and Star our project. +2. Make sure you have CommandBox installed: https://www.ortussolutions.com/products/commandbox#download +3. Start a CommandBox shell in the root of the project: `box` +4. Install the development dependencies: `run-script install:dependencies` +5. Hack away! Create tests under `/test-harness/specs` or wherever they are set in the project and run the tests! + +## Language Compatibility + +Please make sure your code runs on the following CFML Engines: + +- Lucee 5+ +- Adobe ColdFusion 2018+ + +## Coding Styles & Formatting + +We are big on coding styles and have included a `.cfformat.json` in the root of the project so that you can run the formatting tools and CommandBox scripts: + +```bash +# Format everything +box run-script format + +# Start a watcher, type away, save and auto-format for you +box run-script format:watch +``` + +We recommend that anytime you hack on the core you start the formatter watcher (`box run-script format:watch`). This will monitor your changes and auto-format your code for you. + +You can also see the Ortus Coding Standards you must follow here: https://github.com/Ortus-Solutions/coding-standards. + +## CFC Docs With DocBox + +All CFCs are self-documenting and we leverage [DocBox](https://docbox.ortusbooks.com/) to document the entire software. All functions must be properly documented using the DocBox syntax: https://docbox.ortusbooks.com/getting-started/annotating-your-code + + +## Financial Contributions + +You can support ColdBox and all of our Open Source initiatives at Ortus Solutions by becoming a patreon. You can also get lots of goodies and services depending on the level of contributions. + +- [Become a backer or sponsor on Patreon](https://www.patreon.com/ortussolutions) +- [One-time donations via PayPal](https://www.paypal.com/paypalme/ortussolutions) + +## Contributors + +Thank you to all the people who have already contributed to coldbox-cli! We :heart: :heart: :heart: love you! + + + + + + +Made with [contributors-img](https://contrib.rocks) From 6e3c70fb18f7a80f527162c31f713bbae7db9f76 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Thu, 14 Dec 2023 14:48:54 +0100 Subject: [PATCH 05/11] updated formates --- .cfformat.json | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/.cfformat.json b/.cfformat.json index 443ef67..5c04917 100644 --- a/.cfformat.json +++ b/.cfformat.json @@ -1,14 +1,13 @@ { "array.empty_padding": false, "array.padding": true, - "array.multiline.min_length": 50, + "array.multiline.min_length": 40, "array.multiline.element_count": 2, "array.multiline.leading_comma.padding": true, "array.multiline.leading_comma": false, "alignment.consecutive.assignments": true, "alignment.consecutive.properties": true, "alignment.consecutive.params": true, - "alignment.doc_comments" : true, "brackets.padding": true, "comment.asterisks": "align", "binary_operators.padding": true, @@ -18,22 +17,22 @@ "function_call.multiline.leading_comma.padding": true, "function_call.casing.builtin": "cfdocs", "function_call.casing.userdefined": "camel", - "function_call.multiline.element_count": 3, + "function_call.multiline.element_count": 2, "function_call.multiline.leading_comma": false, - "function_call.multiline.min_length": 50, + "function_call.multiline.min_length": 40, "function_declaration.padding": true, "function_declaration.empty_padding": false, "function_declaration.multiline.leading_comma": false, "function_declaration.multiline.leading_comma.padding": true, - "function_declaration.multiline.element_count": 3, - "function_declaration.multiline.min_length": 50, + "function_declaration.multiline.element_count": 2, + "function_declaration.multiline.min_length": 40, "function_declaration.group_to_block_spacing": "compact", "function_anonymous.empty_padding": false, "function_anonymous.group_to_block_spacing": "compact", - "function_anonymous.multiline.element_count": 3, + "function_anonymous.multiline.element_count": 2, "function_anonymous.multiline.leading_comma": false, "function_anonymous.multiline.leading_comma.padding": true, - "function_anonymous.multiline.min_length": 50, + "function_anonymous.multiline.min_length": 40, "function_anonymous.padding": true, "indent_size": 4, "keywords.block_to_keyword_spacing": "spaced", @@ -42,13 +41,13 @@ "keywords.spacing_to_block": "spaced", "keywords.spacing_to_group": true, "keywords.empty_group_spacing": false, - "max_columns": 115, + "max_columns": 120, "metadata.multiline.element_count": 3, - "metadata.multiline.min_length": 50, + "metadata.multiline.min_length": 40, "method_call.chain.multiline" : 3, "newline":"\n", "property.multiline.element_count": 3, - "property.multiline.min_length": 30, + "property.multiline.min_length": 40, "parentheses.padding": true, "strings.quote": "double", "strings.attributes.quote": "double", @@ -58,6 +57,6 @@ "struct.multiline.leading_comma": false, "struct.multiline.leading_comma.padding": true, "struct.multiline.element_count": 2, - "struct.multiline.min_length": 60, + "struct.multiline.min_length": 40, "tab_indent": true } From 01b85388f33b4cccb5555735108e560fc9562e6d Mon Sep 17 00:00:00 2001 From: lmajano Date: Thu, 14 Dec 2023 13:49:23 +0000 Subject: [PATCH 06/11] Apply cfformat changes --- build/Build.cfc | 26 ++++++-- commands/coldbox/create/app-wizard.cfc | 4 +- commands/coldbox/create/bdd.cfc | 4 +- commands/coldbox/create/handler.cfc | 34 +++++++--- commands/coldbox/create/help.cfc | 4 +- commands/coldbox/create/integration-test.cfc | 7 +- commands/coldbox/create/interceptor-test.cfc | 14 ++-- commands/coldbox/create/interceptor.cfc | 14 ++-- commands/coldbox/create/model-test.cfc | 17 +++-- commands/coldbox/create/model.cfc | 57 +++++++++++++---- commands/coldbox/create/module.cfc | 17 ++++- commands/coldbox/create/orm-crud.cfc | 64 +++++++++++++++---- commands/coldbox/create/orm-event-handler.cfc | 6 +- commands/coldbox/create/orm-service.cfc | 13 +++- .../coldbox/create/orm-virtual-service.cfc | 19 +++++- commands/coldbox/create/resource.cfc | 41 ++++++------ commands/coldbox/create/service.cfc | 24 +++++-- commands/coldbox/create/unit.cfc | 4 +- commands/coldbox/reinit.cfc | 6 +- commands/coldbox/watch-reinit.cfc | 17 +++-- models/Utility.cfc | 23 +++++-- 21 files changed, 299 insertions(+), 116 deletions(-) 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 ); From 6ce4127a54454789fb6b2518812a8be150eefb46 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Thu, 14 Dec 2023 14:49:59 +0100 Subject: [PATCH 07/11] updated markdown --- .markdownlint.json | 1 + 1 file changed, 1 insertion(+) diff --git a/.markdownlint.json b/.markdownlint.json index 3707fcb..21bc843 100644 --- a/.markdownlint.json +++ b/.markdownlint.json @@ -11,5 +11,6 @@ "no-duplicate-header" : { "siblings_only" : true }, + "no-duplicate-heading" : false, "no-inline-html" : false } From f3b639cd69ce30e710652b772cf6a6d849d69fd5 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Thu, 14 Dec 2023 14:54:17 +0100 Subject: [PATCH 08/11] more updates to latest template --- build/Build.cfc | 16 ++++++++-------- build/release.boxr | 3 +++ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/build/Build.cfc b/build/Build.cfc index 1376abf..30a6a60 100644 --- a/build/Build.cfc +++ b/build/Build.cfc @@ -48,9 +48,9 @@ component { * Run the build process: test, build source, docs, checksums * * @projectName The project name used for resources and slugs - * @version The version you are building - * @buldID The build identifier - * @branch The branch you are building + * @version The version you are building + * @buldID The build identifier + * @branch The branch you are building */ function run( required projectName, @@ -113,9 +113,9 @@ component { * Build the source * * @projectName The project name used for resources and slugs - * @version The version you are building - * @buldID The build identifier - * @branch The branch you are building + * @version The version you are building + * @buldID The build identifier + * @branch The branch you are building */ function buildSource( required projectName, @@ -300,9 +300,9 @@ component { */ private function ensureExportDir( required projectName, - version = "1.0.0" + version = "1.0.0" ){ - if ( structKeyExists( variables, "exportsDir" ) && directoryExists( variables.exportsDir ) ) { + if ( structKeyExists( variables, "exportsDir" ) && directoryExists( variables.exportsDir ) ){ return; } // Prepare exports directory diff --git a/build/release.boxr b/build/release.boxr index 14b2c02..a63f2cc 100755 --- a/build/release.boxr +++ b/build/release.boxr @@ -9,3 +9,6 @@ # Push all branches back out to github !git push origin --all + +# Check development again +!git checkout -f development From 14e837435233cd3e87ded6224bbaa62ea731647a Mon Sep 17 00:00:00 2001 From: lmajano Date: Thu, 14 Dec 2023 13:54:47 +0000 Subject: [PATCH 09/11] Apply cfformat changes --- build/Build.cfc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/Build.cfc b/build/Build.cfc index 30a6a60..df5f55c 100644 --- a/build/Build.cfc +++ b/build/Build.cfc @@ -300,9 +300,9 @@ component { */ private function ensureExportDir( required projectName, - version = "1.0.0" + version = "1.0.0" ){ - if ( structKeyExists( variables, "exportsDir" ) && directoryExists( variables.exportsDir ) ){ + if ( structKeyExists( variables, "exportsDir" ) && directoryExists( variables.exportsDir ) ) { return; } // Prepare exports directory From 5821d220c7e42eeb5414362ee320cfe4f903125c Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Mon, 12 Feb 2024 09:50:18 +0100 Subject: [PATCH 10/11] new github actions --- .github/workflows/pr.yml | 4 ++-- .github/workflows/release.yml | 14 +++++++------- .github/workflows/snapshot.yml | 6 +++--- .github/workflows/tests.yml | 4 ++-- changelog.md | 4 ++++ 5 files changed, 18 insertions(+), 14 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index d78c2d7..3a5bbf1 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -22,8 +22,8 @@ jobs: runs-on: ubuntu-20.04 steps: - name: Checkout Repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - - uses: Ortus-Solutions/commandbox-action@v1.0.2 + - uses: Ortus-Solutions/commandbox-action@v1.0.3 with: cmd: run-script format:check diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 301fd88..33a74b0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -29,7 +29,7 @@ jobs: runs-on: ubuntu-20.04 steps: - name: Checkout Repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup CommandBox uses: Ortus-Solutions/setup-commandbox@v2.0.1 @@ -64,7 +64,7 @@ jobs: box task run taskfile=build/Build target=run :version=${{ env.VERSION }} :projectName=${{ env.MODULE_ID }} :buildID=${{ github.run_number }} :branch=${{ env.BRANCH }} - name: Commit Changelog To Master - uses: EndBug/add-and-commit@v9.1.1 + uses: EndBug/add-and-commit@v9.1.4 if: env.SNAPSHOT == 'false' with: author_name: Github Actions @@ -73,7 +73,7 @@ jobs: add: changelog.md - name: Tag Version - uses: rickstaa/action-create-tag@v1.6.1 + uses: rickstaa/action-create-tag@v1.7.2 if: env.SNAPSHOT == 'false' with: tag: "v${{ env.VERSION }}" @@ -82,7 +82,7 @@ jobs: - name: Upload Build Artifacts if: success() - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ${{ env.MODULE_ID }} path: | @@ -118,7 +118,7 @@ jobs: box forgebox publish --force - name: Create Github Release - uses: taiki-e/create-gh-release-action@v1.6.2 + uses: taiki-e/create-gh-release-action@v1.8.0 continue-on-error: true if: env.SNAPSHOT == 'false' with: @@ -148,7 +148,7 @@ jobs: forgeboxAPIKey: ${{ secrets.FORGEBOX_TOKEN }} - name: Download build artifacts - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v4 with: name: ${{ env.MODULE_ID }} path: .tmp @@ -165,7 +165,7 @@ jobs: # Commit it back to development - name: Commit Version Bump - uses: EndBug/add-and-commit@v9.1.1 + uses: EndBug/add-and-commit@v9.1.4 with: author_name: Github Actions author_email: info@ortussolutions.com diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml index 45d7dd1..50e9f9d 100644 --- a/.github/workflows/snapshot.yml +++ b/.github/workflows/snapshot.yml @@ -20,15 +20,15 @@ jobs: name: Code Auto-Formatting runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Auto-format - uses: Ortus-Solutions/commandbox-action@v1.0.2 + uses: Ortus-Solutions/commandbox-action@v1.0.3 with: cmd: run-script format - name: Commit Format Changes - uses: stefanzweifel/git-auto-commit-action@v4 + uses: stefanzweifel/git-auto-commit-action@v5 with: commit_message: Apply cfformat changes diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 37c7f94..8a9d6f6 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,10 +13,10 @@ jobs: runs-on: ubuntu-20.04 steps: - name: Checkout Repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Java - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: "temurin" java-version: "11" diff --git a/changelog.md b/changelog.md index 24dbd2b..9de7e2b 100644 --- a/changelog.md +++ b/changelog.md @@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added + +- New github actions + ## [7.2.1] - 2023-05-19 ### Fixed From 94f789c37310fae6a35336e25179acf86bfb2935 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Mon, 12 Feb 2024 10:33:09 +0100 Subject: [PATCH 11/11] - Lazy load `testbox-cli, commandbox-migrations` only when used. --- .gitignore | 1 + box.json | 6 ++-- changelog.md | 1 + commands/coldbox/create/app.cfc | 1 + commands/coldbox/create/bdd.cfc | 4 +-- commands/coldbox/create/unit.cfc | 5 ++-- models/Utility.cfc | 51 ++++++++++++++++++++++++++++++++ 7 files changed, 61 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 8a63cac..6130e5a 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ modules/** # Build Artifacts +.DS_Store .tmp/** .artifacts/** changelog-latest.md diff --git a/box.json b/box.json index c7fd9a9..770205a 100644 --- a/box.json +++ b/box.json @@ -25,11 +25,11 @@ ], "devDependencies":{ "commandbox-cfformat":"*", - "commandbox-docbox":"*" + "commandbox-docbox":"*", + "commandbox-migrations":"^5.0.0", + "testbox-cli":"^1.0.0" }, "dependencies":{ - "commandbox-migrations":"^5.0.0", - "testbox-cli":"^1.0.0" }, "installPaths":{}, "ignore":[ diff --git a/changelog.md b/changelog.md index 9de7e2b..9180dc0 100644 --- a/changelog.md +++ b/changelog.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - New github actions +- Lazy load `testbox-cli, commandbox-migrations` only when used. ## [7.2.1] - 2023-05-19 diff --git a/commands/coldbox/create/app.cfc b/commands/coldbox/create/app.cfc index 3dd4f3a..8173f18 100644 --- a/commands/coldbox/create/app.cfc +++ b/commands/coldbox/create/app.cfc @@ -151,6 +151,7 @@ component extends="coldbox-cli.models.BaseCommand" { // Run migrations init if ( arguments.migrations ) { + variables.utility.ensureMigrationsModule(); command( "migrate init" ).run(); } } diff --git a/commands/coldbox/create/bdd.cfc b/commands/coldbox/create/bdd.cfc index de4bcbd..a99e326 100644 --- a/commands/coldbox/create/bdd.cfc +++ b/commands/coldbox/create/bdd.cfc @@ -8,7 +8,7 @@ * {code} * **/ -component { + component extends="coldbox-cli.models.BaseCommand" { /** * @name Name of the BDD spec to create without the .cfc. For packages, specify name as 'myPackage/myBDDSpec' @@ -20,7 +20,7 @@ component { boolean open = false, directory = "tests/specs" ){ - // proxy to testbox + variables.utility.ensureTestBoxModule(); runCommand( "testbox create bdd name=#arguments.name# directory=#arguments.directory# open=#arguments.open#" ); } diff --git a/commands/coldbox/create/unit.cfc b/commands/coldbox/create/unit.cfc index 3c079ef..783461d 100644 --- a/commands/coldbox/create/unit.cfc +++ b/commands/coldbox/create/unit.cfc @@ -8,7 +8,7 @@ * {code} * **/ -component { + component extends="coldbox-cli.models.BaseCommand" { /** * @name Name of the xUnit Bundle to create without the .cfc. For packages, specify name as 'myPackage/MyServiceTest' @@ -20,8 +20,7 @@ component { boolean open = false, directory = "tests/specs" ){ - // proxy to testbox - // TODO: Migrate this to the `testbox-cli` module. Once that's done, add it as a dependency. + variables.utility.ensureTestBoxModule(); runCommand( "testbox create unit name=#arguments.name# directory=#arguments.directory# open=#arguments.open#" ); } diff --git a/models/Utility.cfc b/models/Utility.cfc index 1f2a560..7523769 100644 --- a/models/Utility.cfc +++ b/models/Utility.cfc @@ -1,8 +1,59 @@ component singleton { + // DI + property name="moduleService" inject="ModuleService"; + property name="wirebox" inject="wirebox"; + property name="print" inject="PrintBuffer"; + this.BREAK = chr( 13 ) & chr( 10 ); this.TAB = chr( 9 ); + /** + * Verify that the TestBox module is installed + * else install it + */ + function ensureTestBoxModule(){ + if( !isTestBoxModuleInstalled() ){ + variables.print + .redLine( "TestBox-CLI module not installed. Installing it for you, please wait..." ) + .line() + .toConsole(); + variables.wirebox + .getInstance( name : "CommandDSL", initArguments : { name : "install testbox-cli" } ) + .run(); + } + } + + /** + * Verify that the CommandBox Migrations module is installed + * else install it + */ + function ensureMigrationsModule(){ + if( !isMigrationsModuleInstalled() ){ + variables.print + .redLine( "CommandBox-Migrations module not installed. Installing it for you, please wait..." ) + .line() + .toConsole(); + variables.wirebox + .getInstance( name : "CommandDSL", initArguments : { name : "install commandbox-migrations" } ) + .run(); + } + } + + /** + * Is TestBox module installed + */ + boolean function isTestBoxModuleInstalled(){ + return variables.moduleService.getModuleRegistry().keyArray().findNoCase( "testbox-cli" ) > 0 ? true : false; + } + + /** + * Is CommandBox Migrations module installed + */ + boolean function isMigrationsModuleInstalled(){ + return variables.moduleService.getModuleRegistry().keyArray().findNoCase( "commandbox-migrations" ) > 0 ? true : false; + } + /** * Convert a plural word to a singular word *