From 82d085739ab80d9401a64228a4a1dfbeb7b38161 Mon Sep 17 00:00:00 2001 From: Brad Wood Date: Mon, 18 Nov 2019 14:55:39 -0600 Subject: [PATCH 1/5] version bump --- box.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/box.json b/box.json index 576204e..2d4a079 100644 --- a/box.json +++ b/box.json @@ -1,7 +1,7 @@ { "name":"ColdBox Route Visualizer", "author":"Ortus Solutions.com ", - "version":"1.4.0", + "version":"1.5.0", "location":"https://downloads.ortussolutions.com/ortussolutions/coldbox-modules/route-visualizer/@build.version@/route-visualizer-@build.version@.zip", "slug":"route-visualizer", "type":"modules", From 43ac41bb9aaae792b33b0024258ba3a950a7dcc8 Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Mon, 27 Mar 2023 17:32:02 +0200 Subject: [PATCH 2/5] ### Added - Migration to github actions - Migration to new module template ### Removed - ACF2016 Support - ColdBox 5 Support --- .cfconfig.json | 26 + .cfformat.json | 63 ++ .cflintrc | 12 +- .env.template | 7 + .gitattributes | 20 +- .github/FUNDING.YML | 1 + .github/ISSUE_TEMPLATE/BUG_REPORT.md | 33 ++ .github/ISSUE_TEMPLATE/FEATURE_REQUEST.md | 18 + .github/PULL_REQUEST_TEMPLATE.md | 29 + .github/workflows/ci.yml | 107 ++++ .github/workflows/gh-release.yml | 19 + .github/workflows/pr.yml | 28 + .github/workflows/tests.yml | 112 ++++ .gitignore | 17 +- .jsbeautifyrc | 42 -- .markdownlint.json | 15 + .travis.yml | 107 ---- .vscode/settings.json | 14 + .vscode/tasks.json | 33 ++ ModuleConfig.cfc | 123 +--- box.json | 20 +- build/Build.cfc | 551 ++++++++++-------- build/SetupTemplate.cfc | 70 +++ build/{toMaster.boxr => release.boxr} | 18 +- changelog.md | 33 +- handlers/Home.cfc | 12 +- readme.md | 67 ++- ...-adobe@2018.json => server-adobe@2018.json | 12 +- server-adobe@2021.json | 29 + ...server-lucee@5.json => server-lucee@5.json | 11 +- test-harness/.cfconfig.json | 8 - test-harness/.cflintrc | 1 - test-harness/Application.cfc | 2 +- test-harness/config/Coldbox.cfc | 11 +- test-harness/config/Router.cfc | 9 + test-harness/config/Routes.cfm | 46 -- test-harness/config/WireBox.cfc | 46 -- test-harness/layouts/Main.cfm | 4 +- test-harness/main/index.cfm | 3 + test-harness/server-adobe@11.json | 16 - test-harness/server-adobe@2016.json | 16 - test-harness/server-lucee@45.json | 16 - test-harness/tests/Application.cfc | 76 ++- test-harness/tests/specs/MainTests.cfc | 29 +- views/home/index.cfm | 2 +- 45 files changed, 1182 insertions(+), 752 deletions(-) create mode 100644 .cfconfig.json create mode 100644 .cfformat.json create mode 100644 .env.template mode change 100644 => 100755 .gitattributes create mode 100644 .github/FUNDING.YML create mode 100644 .github/ISSUE_TEMPLATE/BUG_REPORT.md create mode 100644 .github/ISSUE_TEMPLATE/FEATURE_REQUEST.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/gh-release.yml create mode 100644 .github/workflows/pr.yml create mode 100644 .github/workflows/tests.yml delete mode 100644 .jsbeautifyrc create mode 100644 .markdownlint.json delete mode 100644 .travis.yml create mode 100644 .vscode/settings.json create mode 100644 .vscode/tasks.json create mode 100644 build/SetupTemplate.cfc rename build/{toMaster.boxr => release.boxr} (64%) rename test-harness/server-adobe@2018.json => server-adobe@2018.json (55%) create mode 100644 server-adobe@2021.json rename test-harness/server-lucee@5.json => server-lucee@5.json (60%) delete mode 100644 test-harness/.cfconfig.json delete mode 100644 test-harness/.cflintrc create mode 100755 test-harness/config/Router.cfc delete mode 100644 test-harness/config/Routes.cfm delete mode 100644 test-harness/config/WireBox.cfc create mode 100644 test-harness/main/index.cfm delete mode 100644 test-harness/server-adobe@11.json delete mode 100644 test-harness/server-adobe@2016.json delete mode 100644 test-harness/server-lucee@45.json diff --git a/.cfconfig.json b/.cfconfig.json new file mode 100644 index 0000000..3bddab6 --- /dev/null +++ b/.cfconfig.json @@ -0,0 +1,26 @@ +{ + "adminPassword" : "coldbox", + "debuggingEnabled":true, + "debuggingReportExecutionTimes":false, + "disableInternalCFJavaComponents":false, + "inspectTemplate":"always", + "requestTimeout":"0,0,0,90", + "robustExceptionEnabled":true, + "datasources": { + "coolblog": { + "class":"${DB_CLASS}", + "dbdriver": "MySQL", + "dsn":"jdbc:mysql://{host}:{port}/{database}", + "custom":"useUnicode=true&characterEncoding=UTF8&serverTimezone=UTC&useLegacyDatetimeCode=true&autoReconnect=true&useSSL=false", + "host":"${DB_HOST:127.0.0.1}", + "username": "${DB_USER:root}", + "password": "${DB_PASSWORD}", + "database": "coolblog", + "port": "${DB_PORT:3306}", + "storage":"false", + "bundleName": "${DB_BUNDLENAME}", + "bundleVersion": "${DB_BUNDLEVERSION}", + "validate":"false" + } + } +} \ No newline at end of file diff --git a/.cfformat.json b/.cfformat.json new file mode 100644 index 0000000..443ef67 --- /dev/null +++ b/.cfformat.json @@ -0,0 +1,63 @@ +{ + "array.empty_padding": false, + "array.padding": true, + "array.multiline.min_length": 50, + "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, + "for_loop_semicolons.padding": true, + "function_call.empty_padding": false, + "function_call.padding": true, + "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.leading_comma": false, + "function_call.multiline.min_length": 50, + "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.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.leading_comma": false, + "function_anonymous.multiline.leading_comma.padding": true, + "function_anonymous.multiline.min_length": 50, + "function_anonymous.padding": true, + "indent_size": 4, + "keywords.block_to_keyword_spacing": "spaced", + "keywords.group_to_block_spacing": "spaced", + "keywords.padding_inside_group": true, + "keywords.spacing_to_block": "spaced", + "keywords.spacing_to_group": true, + "keywords.empty_group_spacing": false, + "max_columns": 115, + "metadata.multiline.element_count": 3, + "metadata.multiline.min_length": 50, + "method_call.chain.multiline" : 3, + "newline":"\n", + "property.multiline.element_count": 3, + "property.multiline.min_length": 30, + "parentheses.padding": true, + "strings.quote": "double", + "strings.attributes.quote": "double", + "struct.separator": " : ", + "struct.padding": true, + "struct.empty_padding": false, + "struct.multiline.leading_comma": false, + "struct.multiline.leading_comma.padding": true, + "struct.multiline.element_count": 2, + "struct.multiline.min_length": 60, + "tab_indent": true +} diff --git a/.cflintrc b/.cflintrc index cc2fa6f..a3e8368 100644 --- a/.cflintrc +++ b/.cflintrc @@ -1,20 +1,16 @@ { "rule": [], "includes": [ - { "code": "AVOID_USING_STRUCTNEW" }, - { "code": "AVOID_USING_ARRAYNEW" }, { "code": "AVOID_USING_CFINCLUDE_TAG" }, { "code": "AVOID_USING_CFABORT_TAG" }, { "code": "AVOID_USING_CFEXECUTE_TAG" }, { "code": "AVOID_USING_DEBUG_ATTR" }, - { "code": "AVOID_USING_CREATEOBJECT" }, { "code": "AVOID_USING_ABORT" }, { "code": "AVOID_USING_ISDATE" }, { "code": "AVOID_USING_ISDEBUGMODE" }, { "code": "AVOID_USING_CFINSERT_TAG" }, { "code": "AVOID_USING_CFUPDATE_TAG" }, { "code": "ARG_VAR_CONFLICT" }, - { "code": "ARG_VAR_MIXED" }, { "code": "ARG_HINT_MISSING" }, { "code": "ARG_HINT_MISSING_SCRIPT" }, { "code" : "ARGUMENT_INVALID_NAME" }, @@ -32,8 +28,6 @@ { "code" : "COMPONENT_IS_TEMPORARY" }, { "code" : "COMPONENT_HAS_PREFIX_OR_POSTFIX" }, { "code": "COMPLEX_BOOLEAN_CHECK" }, - { "code": "EXCESSIVE_FUNCTION_LENGTH" }, - { "code": "EXCESSIVE_COMPONENT_LENGTH" }, { "code": "EXCESSIVE_ARGUMENTS" }, { "code": "EXCESSIVE_FUNCTIONS" }, { "code": "EXPLICIT_BOOLEAN_CHECK" }, @@ -41,7 +35,6 @@ { "code": "FUNCTION_HINT_MISSING" }, { "code": "FILE_SHOULD_START_WITH_LOWERCASE" }, { "code": "LOCAL_LITERAL_VALUE_USED_TOO_OFTEN" }, - { "code": "GLOBAL_VAR" }, { "code": "GLOBAL_LITERAL_VALUE_USED_TOO_OFTEN" }, { "code": "MISSING_VAR" }, { "code" : "METHOD_INVALID_NAME" }, @@ -57,11 +50,10 @@ { "code": "SCOPE_ALLCAPS_NAME" }, { "code": "VAR_ALLCAPS_NAME" }, { "code": "VAR_INVALID_NAME" }, - { "code": "VAR_TOO_WORDY" }, - { "code": "VAR_IS_TEMPORARY" } + { "code": "VAR_TOO_WORDY" } ], "inheritParent": false, "parameters": { - "TooManyFunctionsChecker.maximum" : 20 + "TooManyFunctionsChecker.maximum" : 50 } } \ No newline at end of file diff --git a/.env.template b/.env.template new file mode 100644 index 0000000..c50097f --- /dev/null +++ b/.env.template @@ -0,0 +1,7 @@ +DB_HOST=127.0.0.1 +DB_PORT=3306 +DB_USER=root +DB_PASSWORD=mysql +DB_CLASS=com.mysql.cj.jdbc.Driver +DB_BUNDLEVERSION=8.0.19 +DB_BUNDLENAME=com.mysql.cj \ No newline at end of file diff --git a/.gitattributes b/.gitattributes old mode 100644 new mode 100755 index 412eeda..6846c75 --- a/.gitattributes +++ b/.gitattributes @@ -10,13 +10,13 @@ *.dbproj merge=union # Standard to msysgit -*.doc diff=astextplain -*.DOC diff=astextplain -*.docx diff=astextplain -*.DOCX diff=astextplain -*.dot diff=astextplain -*.DOT diff=astextplain -*.pdf diff=astextplain -*.PDF diff=astextplain -*.rtf diff=astextplain -*.RTF diff=astextplain +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain diff --git a/.github/FUNDING.YML b/.github/FUNDING.YML new file mode 100644 index 0000000..7e59d13 --- /dev/null +++ b/.github/FUNDING.YML @@ -0,0 +1 @@ +patreon: ortussolutions diff --git a/.github/ISSUE_TEMPLATE/BUG_REPORT.md b/.github/ISSUE_TEMPLATE/BUG_REPORT.md new file mode 100644 index 0000000..300232e --- /dev/null +++ b/.github/ISSUE_TEMPLATE/BUG_REPORT.md @@ -0,0 +1,33 @@ +--- +name: Bug report +about: Create a report to help us improve +--- + + + +## What are the steps to reproduce this issue? + +1. … +2. … +3. … + +## What happens? + +… + +## What were you expecting to happen? + +… + +## Any logs, error output, etc? + +… + +## Any other comments? + +… + +## What versions are you using? + +**Operating System:** … +**Package Version:** … diff --git a/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md new file mode 100644 index 0000000..c10946f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md @@ -0,0 +1,18 @@ +--- +name: Feature Request +about: Request a new feature or enhancement +--- + + + +## Summary + + + +## Detailed Description + + + +## Possible Implementation Ideas + + diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..e8bd9f9 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,29 @@ +# Description + +Please include a summary of the changes and which issue(s) is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change. + +**Please note that all PRs must have tests attached to them** + +IMPORTANT: Please review the [CONTRIBUTING.md](../CONTRIBUTING.md) file for detailed contributing guidelines. + +## Issues + +All PRs must have an accompanied issue. Please make sure you created it and linked it here. + +## Type of change + +Please delete options that are not relevant. + +- [ ] Bug Fix +- [ ] Improvement +- [ ] New Feature +- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) +- [ ] This change requires a documentation update + +## Checklist + +- [ ] My code follows the style guidelines of this project [cfformat](../.cfformat.json) +- [ ] I have commented my code, particularly in hard-to-understand areas +- [ ] I have made corresponding changes to the documentation +- [ ] I have added tests that prove my fix is effective or that my feature works +- [ ] New and existing unit tests pass locally with my changes diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..cf42ff4 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,107 @@ +name: route-visualizer CI + +# Only on Development we build snapshots +on: + push: + branches: + - development + - master + +env: + MODULE_ID: route-visualizer + +jobs: + ############################################# + # Tests First baby! We fail, no build :( + ############################################# + tests: + uses: ./.github/workflows/tests.yml + secrets: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + + ############################################# + # Build ContentBox + ############################################# + build: + name: Build & Publish + needs: tests + runs-on: ubuntu-20.04 + steps: + - name: Checkout Repository + uses: actions/checkout@v3.2.0 + + - name: Setup Java + uses: actions/setup-java@v3.9.0 + with: + distribution: "temurin" + java-version: "11" + + - name: Setup CommandBox + uses: Ortus-Solutions/setup-commandbox@v2.0.1 + with: + forgeboxAPIKey: ${{ secrets.FORGEBOX_TOKEN }} + + - name: Setup Environment Variables For Build Process + id: current_version + run: | + echo "VERSION=`cat box.json | jq '.version' -r`" >> $GITHUB_ENV + box package set version=@build.version@+@build.number@ + # master or snapshot + echo "Github Ref is $GITHUB_REF" + echo "BRANCH=master" >> $GITHUB_ENV + if [ $GITHUB_REF == 'refs/heads/development' ] + then + echo "BRANCH=development" >> $GITHUB_ENV + fi + - name: Build ${{ env.MODULE_ID }} + run: | + box install commandbox-docbox + box task run taskfile=build/Build target=run :version=${{ env.VERSION }} :projectName=${{ env.MODULE_ID }} :buildID=${{ github.run_number }} :branch=${{ env.BRANCH }} + + - name: Upload Build Artifacts + if: success() + uses: actions/upload-artifact@v3.1.1 + with: + name: ${{ env.MODULE_ID }} + path: | + .artifacts/**/* + + - name: Upload Binaries to S3 + uses: jakejarvis/s3-sync-action@master + with: + args: --acl public-read + env: + AWS_S3_BUCKET: "downloads.ortussolutions.com" + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_ACCESS_SECRET }} + SOURCE_DIR: ".artifacts/${{ env.MODULE_ID }}" + DEST_DIR: "ortussolutions/coldbox-modules/${{ env.MODULE_ID }}" + + - name: Upload API Docs to S3 + uses: jakejarvis/s3-sync-action@master + with: + args: --acl public-read + env: + AWS_S3_BUCKET: "apidocs.ortussolutions.com" + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_ACCESS_SECRET }} + SOURCE_DIR: ".tmp/apidocs" + DEST_DIR: "coldbox-modules/${{ env.MODULE_ID }}/${{ env.VERSION }}" + + - name: Publish To ForgeBox + run: | + cd .tmp/${{ env.MODULE_ID }} + cat box.json + box forgebox publish + + - name: Inform Slack of Build + if: ${{ always() }} + uses: rtCamp/action-slack-notify@v2 + env: + SLACK_CHANNEL: coding + SLACK_COLOR: ${{ job.status }} # or a specific color like 'green' or '#ff00ff' + SLACK_ICON_EMOJI: ":bell:" + SLACK_MESSAGE: '${{ env.MODULE_ID }} Built with ${{ job.status }}!' + SLACK_TITLE: "${{ env.MODULE_ID }} Build" + SLACK_USERNAME: CI + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} diff --git a/.github/workflows/gh-release.yml b/.github/workflows/gh-release.yml new file mode 100644 index 0000000..3de37b9 --- /dev/null +++ b/.github/workflows/gh-release.yml @@ -0,0 +1,19 @@ +# Publish Github Release +name: Github Release + +on: + push: + tags: + - v[0-9]+.* + +jobs: + create-release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3.2.0 + - uses: taiki-e/create-gh-release-action@v1.6.1 + with: + # Produced by the build/Build.cfc + changelog: changelog.md + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000..b77d2c9 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,28 @@ +name: Pull Requests + +on: + push: + branches-ignore: + - "main" + - "master" + - "development" + - "v*" + pull_request: + branches: + - "v*" + - development + +jobs: + tests: + uses: ./.github/workflows/tests.yml + + formatCheck: + name: Checks Source Code Formatting + runs-on: ubuntu-20.04 + steps: + - name: Checkout Repository + uses: actions/checkout@v3.2.0 + + - uses: Ortus-Solutions/commandbox-action@v1.0.2 + with: + cmd: run-script format:check diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..8526c21 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,112 @@ +name: Test Suites + +# We are a reusable Workflow only +on: + workflow_call: + secrets: + SLACK_WEBHOOK_URL: + required: true + +jobs: + tests: + name: Tests + runs-on: ubuntu-20.04 + env: + DB_USER: root + DB_PASSWORD: root + strategy: + fail-fast: false + matrix: + cfengine: [ "lucee@5", "adobe@2018", "adobe@2021" ] + steps: + - name: Checkout Repository + uses: actions/checkout@v3.2.0 + + # Not Needed in this module + #- name: Setup Database and Fixtures + # run: | + # sudo /etc/init.d/mysql start + # mysql -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }} -e 'CREATE DATABASE coolblog;' + # mysql -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }} < test-harness/tests/resources/coolblog.sql + + - name: Setup Java + uses: actions/setup-java@v3.9.0 + with: + distribution: "temurin" + java-version: "11" + + - name: Setup CommandBox CLI + uses: Ortus-Solutions/setup-commandbox@v2.0.1 + + # Not Needed in this module + #- name: Setup Environment For Testing Process + # working-directory: ./test-harness + # run: | + # # Setup .env + # touch .env + # # ENV + # printf "DB_HOST=localhost\n" >> .env + # printf "DB_DATABASE=mydatabase\n" >> .env + # printf "DB_DRIVER=MySQL\n" >> .env + # printf "DB_USER=${{ env.DB_USER }}\n" >> .env + # printf "DB_PASSWORD=${{ env.DB_PASSWORD }}\n" >> .env + # printf "DB_CLASS=com.mysql.cj.jdbc.Driver\n" >> .env + # printf "DB_BUNDLEVERSION=8.0.19\n" >> .env + # printf "DB_BUNDLENAME=com.mysql.cj\n" >> .env + + - name: Install Test Harness Dependencies + run: | + box install + cd test-harness && box install + + - name: Start ${{ matrix.cfengine }} Server + run: | + box server start serverConfigFile="server-${{ matrix.cfengine }}.json" --noSaveSettings --debug + curl http://127.0.0.1:60299 + + - name: Run Tests + run: | + mkdir -p test-harness/tests/results + box testbox run --verbose outputFile=test-harness/tests/results/test-results outputFormats=json,antjunit + + - name: Publish Test Results + uses: EnricoMi/publish-unit-test-result-action@v2 + if: always() + with: + junit_files: test-harness/tests/results/**/*.xml + check_name: "${{ matrix.cfengine }} Test Results" + + - name: Upload Test Results to Artifacts + if: always() + uses: actions/upload-artifact@v3.1.1 + with: + name: test-results-${{ matrix.cfengine }} + path: | + test-harness/tests/results/**/* + + - name: Show Server Log On Failures + if: ${{ failure() }} + run: | + box server log serverConfigFile="server-${{ matrix.cfengine }}.json" + + - name: Upload Debug Logs To Artifacts + if: ${{ failure() }} + uses: actions/upload-artifact@v3.1.1 + with: + name: Failure Debugging Info - ${{ matrix.cfengine }} + path: | + .engine/**/logs/* + .engine/**/WEB-INF/cfusion/logs/* + + - name: Slack Notifications + # Only on failures and NOT in pull requests + if: ${{ failure() && !startsWith( 'pull_request', github.event_name ) }} + uses: rtCamp/action-slack-notify@v2 + env: + SLACK_CHANNEL: coding + SLACK_COLOR: ${{ job.status }} # or a specific color like 'green' or '#ff00ff' + SLACK_ICON_EMOJI: ":bell:" + SLACK_MESSAGE: '${{ github.repository }} tests failed :cry:' + SLACK_TITLE: ${{ github.repository }} Tests For ${{ matrix.cfengine }} failed + SLACK_USERNAME: CI + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} diff --git a/.gitignore b/.gitignore index ba263a8..308bbea 100644 --- a/.gitignore +++ b/.gitignore @@ -1,17 +1,20 @@ -.project -settings.xml -.vscode -.settings - +# Artifacts and temp folders .artifacts/** .tmp/** -test-harness/.engine/** +# Engine + Secrets +.env +.engine/** + +# Dependencies test-harness/coldbox/** test-harness/docbox/** test-harness/testbox/** test-harness/logs/** test-harness/modules/** +# modules +modules/** + # log files -logs/** \ No newline at end of file +logs/** diff --git a/.jsbeautifyrc b/.jsbeautifyrc deleted file mode 100644 index cc0c245..0000000 --- a/.jsbeautifyrc +++ /dev/null @@ -1,42 +0,0 @@ -{ - "beautify.language": { - "js": ["js","json","cfc"], - "css": ["css", "scss"], - "html": ["htm", "html", "cfml", "cfm"] - }, - "brace_style": "collapse", - "indent_with_tabs": true, - "indent_size": 4, - "indent_level": 0, - "preserve_newlines": true, - "max_preserve_newlines": 5, - "html": { - "allowed_file_extensions": ["htm", "html", "xhtml", "shtml", "xml", "svg", "cfm", "cfml"], - "indent_scripts": "keep", - "indent_inner_html": true, - "indent_body_inner_html": true, - "indent_handlebars": true, - "unformatted": ["code", "pre"], - "content_unformatted": ["pre", "code"], - "wrap_line_length": 0 - }, - "css": { - "selector_separator_newline": true - }, - "js": { - "break_chained_methods": true, - "comma_first": false, - "e4x": false, - "jslint_happy": true, - "keep_function_indentation": true, - "keep_array_indentation": true, - "space_after_anon_function": false, - "spaceBeforeConditional": true, - "space_in_paren": true, - "space_in_empty_paren": false, - "space_before_conditional": true, - "operator_position": "before-newline", - "unescape_strings": false, - "wrap_line_length": 0 - } -} \ No newline at end of file diff --git a/.markdownlint.json b/.markdownlint.json new file mode 100644 index 0000000..3707fcb --- /dev/null +++ b/.markdownlint.json @@ -0,0 +1,15 @@ +{ + "line-length": false, + "single-h1": false, + "no-hard-tabs" : false, + "fenced-code-language" : false, + "no-bare-urls" : false, + "first-line-h1": false, + "no-multiple-blanks": { + "maximum": 2 + }, + "no-duplicate-header" : { + "siblings_only" : true + }, + "no-inline-html" : false +} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index f010268..0000000 --- a/.travis.yml +++ /dev/null @@ -1,107 +0,0 @@ -language: java - -notifications: - slack: - secure: FIHlTn/YO7Wgumm1uIqmoEsqjQA7fV0AE94Rjc5yKzM3AquQa8HicgDVVk0d2GrKRnl0xt3j4ZJV//VJyIjlCd/QVKuj48R2ChjEY2im3+99HFPafCUI5/S2uyowKU6mJTFonH9v6p41eqxdbiAxJdDGOT0V2Gpt3UBSNuHz8ED9/aIHqv+P7M+VD6Xd2XYwctPniWlaSWx57sWcnG/VkFG45qFQAyha64uxOOe4M3ZmG/n5FfauZ8cBVLiRKEIr+CyNhh1ujfzi7+4uzMlSNL5t/BbZamAQuZzqGzGQ9RVvIlyPgUGNJtDEE/hWS09aagXF5T6EMj00szizErh4J1/x4qZwml5+TcBN31E0QmAhCtZe85sr3tYgic+hEz9XX1yymQzf/C7n4to2yNvq0r4g51xDk8IuP95WEh7zaqLlvFZvBFgxpHZBMYlRvhytjOYDeIFRMcGwHZcXosaG2ejqDwcGq/LC4oeG4sSwmg9sdRrtcmcanrNqrBka86WYO6LntI3JdZ86/1ACEUHzhCCwvrKELc9Ji1xxGAgS7QKH+s2/hnJuiMyv73gOVLKYC+wPMLt+fvOmPLSEl+PJiAIlToBq1KUBg03RSQLfPOLD7OrJ8VvDZsEPwejqlGDyc4wRglS9OTi7SnN5LYHSDNDdGdREegWqq9qDHEYEVLI= - -env: - # Fill out these global variables for build process - global: - - MODULE_ID=route-visualizer - matrix: - - ENGINE=lucee@5 - - ENGINE=adobe@11 - - ENGINE=adobe@2016 - - ENGINE=adobe@2018 - -branches: - only: - - development - - master - -dist: trusty - -sudo: required - -before_install: - # CommandBox Keys - - curl -fsSl https://downloads.ortussolutions.com/debs/gpg | sudo apt-key add - - - sudo echo "deb http://downloads.ortussolutions.com/debs/noarch /" | sudo tee -a - /etc/apt/sources.list.d/commandbox.list - -install: - # Install Commandbox - - sudo apt-get update && sudo apt-get --assume-yes install rsync jq commandbox - # Install CommandBox Supporting Librarires - - box install commandbox-cfconfig,commandbox-dotenv,commandbox-docbox - # If using auto-publish, you will need to provide your API token with this line: - - box config set endpoints.forgebox.APIToken=$FORGEBOX_API_TOKEN > /dev/null - -script: - # Set Current Version - - TARGET_VERSION=`cat $TRAVIS_BUILD_DIR/box.json | jq '.version' -r` - - echo "Starting build for ${MODULE_ID} v${TARGET_VERSION}" - # Startup the harness - - cd test-harness - # run our dependency install to ensure the workbench is in place - - box install - # run our matrix server - - box server start serverConfigFile="server-${ENGINE}.json" - # Startup the app - - curl http://localhost:60299 - # Debugging of tests - #- curl http://localhost:60299/tests/runner.cfm?reporter=json -o testresults.json && cat testresults.json - # move back to build dir to build it - - cd $TRAVIS_BUILD_DIR - # Build Project - - box task run taskfile=build/Build target=run :version=${TARGET_VERSION} :projectName=${MODULE_ID} :buildID=${TRAVIS_BUILD_NUMBER} :branch=${TRAVIS_BRANCH} - # Cat results for debugging - - cat build/results.json - -after_failure: - - cd $TRAVIS_BUILD_DIR/test-harness - # Display the contents of our root directory - # Spit out our Commandbox log in case we need to debug - - box server log server-${ENGINE}.json - - cat `box system-log` - -deploy: - # Module Deployment - - provider: s3 - on: - branch: - - master - - development - condition: "$ENGINE = lucee@5" - skip_cleanup: true - #AWS Credentials need to be set in Travis - access_key_id: $AWS_ACCESS_KEY - secret_access_key: $AWS_ACCESS_SECRET - # Destination - bucket: "downloads.ortussolutions.com" - local-dir: $TRAVIS_BUILD_DIR/.artifacts/$MODULE_ID - upload-dir: ortussolutions/coldbox-modules/$MODULE_ID - acl: public_read - - # API Docs Deployment - - provider: s3 - on: - branch: - - master - - development - condition: "$ENGINE = lucee@5" - skip_cleanup: true - #AWS Credentials need to be set in Travis - access_key_id: $AWS_ACCESS_KEY - secret_access_key: $AWS_ACCESS_SECRET - bucket: "apidocs.ortussolutions.com" - local-dir: $TRAVIS_BUILD_DIR/.tmp/apidocs - upload-dir: coldbox-modules/$MODULE_ID/$TARGET_VERSION - acl: public_read - -after_deploy: - # Move to build out artifact - - cd ${TRAVIS_BUILD_DIR}/.tmp/${MODULE_ID} - - cat box.json - # Only publish once - - if [ ${ENGINE} = 'lucee@5' ]; then box forgebox publish; fi diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..2506a17 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,14 @@ +{ + "cfml.mappings": [ + { + "logicalPath": "/coldbox", + "directoryPath": "./test-harness/coldbox", + "isPhysicalDirectoryPath": false + }, + { + "logicalPath": "/testbox", + "directoryPath": "./test-harness/testbox", + "isPhysicalDirectoryPath": false + } + ] +} diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..8921b11 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,33 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "Run CommandBox Task", + "type": "shell", + "command": "box task run ${relativeFile}", + "group": { + "kind": "build", + "isDefault": true + }, + "presentation": { + "reveal": "always", + "panel": "new" + }, + "problemMatcher": [] + }, + { + "label": "Run TestBox Bundle", + "type": "shell", + "command": "box testbox run bundles=${relativeFile}", + "group": { + "kind": "build", + "isDefault": true + }, + "presentation": { + "reveal": "always", + "panel": "new" + }, + "problemMatcher": [] + } + ] +} diff --git a/ModuleConfig.cfc b/ModuleConfig.cfc index 09f80ba..0d9d54f 100644 --- a/ModuleConfig.cfc +++ b/ModuleConfig.cfc @@ -1,130 +1,49 @@ /** -Module Directives as public properties -this.title = "Title of the module"; -this.author = "Author of the module"; -this.webURL = "Web URL for docs purposes"; -this.description = "Module description"; -this.version = "Module Version"; -this.viewParentLookup = (true) [boolean] (Optional) // If true, checks for views in the parent first, then it the module.If false, then modules first, then parent. -this.layoutParentLookup = (true) [boolean] (Optional) // If true, checks for layouts in the parent first, then it the module.If false, then modules first, then parent. -this.entryPoint = "" (Optional) // If set, this is the default event (ex:forgebox:manager.index) or default route (/forgebox) the framework - will use to create an entry link to the module. Similar to a default event. -this.cfmapping = "The CF mapping to create"; -this.modelNamespace = "The namespace to use for registered models, if blank it uses the name of the module." -this.dependencies = "The array of dependencies for this module" - -structures to create for configuration -- parentSettings : struct (will append and override parent) -- settings : struct -- interceptorSettings : struct of the following keys ATM - - customInterceptionPoints : string list of custom interception points -- interceptors : array -- layoutSettings : struct (will allow to define a defaultLayout for the module) -- routes : array Allowed keys are same as the addRoute() method of the SES interceptor. -- wirebox : The wirebox DSL to load and use - -Available objects in variable scope -- controller -- appMapping (application mapping) -- moduleMapping (include,cf path) -- modulePath (absolute path) -- log (A pre-configured logBox logger object for this object) -- binder (The wirebox configuration binder) -- wirebox (The wirebox injector) - -Required Methods -- configure() : The method ColdBox calls to configure the module. - -Optional Methods -- onLoad() : If found, it is fired once the module is fully loaded -- onUnload() : If found, it is fired once the module is unloaded - -*/ + * Copyright Since 2005 ColdBox Framework by Luis Majano and Ortus Solutions, Corp + * www.ortussolutions.com + * --- + */ component { // Module Properties - this.title = "route-visualizer"; - this.author = ""; - this.webURL = ""; - this.description = ""; - this.version = "1.0.0"; + this.title = "Route Visualizer"; + this.author = "Ortus Solutions"; + this.webURL = "https://www.ortussolutions.com"; + this.description = "A development module to visualize your application routes"; + this.version = "@build.version@+@build.number@"; // If true, looks for views in the parent first, if not found, then in the module. Else vice-versa - this.viewParentLookup = true; + this.viewParentLookup = true; // If true, looks for layouts in the parent first, if not found, then in module. Else vice-versa this.layoutParentLookup = true; // Module Entry Point - this.entryPoint = "route-visualizer"; + this.entryPoint = "route-visualizer"; // Inherit Entry Point - this.inheritEntryPoint = false; + this.inheritEntryPoint = false; // Model Namespace - this.modelNamespace = "route-visualizer"; - // CF Mapping - this.cfmapping = "route-visualizer"; + this.modelNamespace = "route-visualizer"; // Auto-map models - this.autoMapModels = true; + this.autoMapModels = true; // Module Dependencies - this.dependencies = []; + this.dependencies = []; function configure(){ - - // parent settings - parentSettings = { - - }; - // module settings - stored in modules.name.settings - settings = { - - }; + settings = {}; // Layout Settings - layoutSettings = { - defaultLayout = "Main.cfm" - }; - - // ColdBox 4 compat routing - routes = [ - // Module Entry Point - { pattern="/", handler="home",action="index" }, - // Convention Route - { pattern="/:handler/:action?" } - ]; - - // ColdBox 5 compat routing - //router.route( "/" ).to( "home.index" ); - //router.route( "/:handler/:action?" ).end(); - - // SES Resources - resources = [ - // { resource = "" } - ]; - - // Custom Declared Points - interceptorSettings = { - customInterceptionPoints = "" - }; - - // Custom Declared Interceptors - interceptors = [ - ]; - - // Binder Mappings - // binder.map("Alias").to("#moduleMapping#.model.MyService"); - + layoutSettings = { defaultLayout : "Main.cfm" }; } /** - * Fired when the module is registered and activated. - */ + * Fired when the module is registered and activated. + */ function onLoad(){ - } /** - * Fired when the module is unregistered and unloaded - */ + * Fired when the module is unregistered and unloaded + */ function onUnload(){ - } } diff --git a/box.json b/box.json index 2d4a079..4102c8e 100644 --- a/box.json +++ b/box.json @@ -1,7 +1,7 @@ { "name":"ColdBox Route Visualizer", "author":"Ortus Solutions.com ", - "version":"1.5.0", + "version":"2.0.0", "location":"https://downloads.ortussolutions.com/ortussolutions/coldbox-modules/route-visualizer/@build.version@/route-visualizer-@build.version@.zip", "slug":"route-visualizer", "type":"modules", @@ -22,11 +22,21 @@ "Brad Wood " ], "ignore":[ - "**/.*", + "**/.*", "test-harness", - "*/.md" + "/server*.json" ], "scripts":{ - "toMaster":"recipe build/toMaster.boxr" + "setupTemplate": "task run taskFile=build/SetupTemplate.cfc", + "build:module":"task run taskFile=build/Build.cfc :projectName=`package show slug` :version=`package show version`", + "build:docs":"task run taskFile=build/Build.cfc target=docs :projectName=`package show slug` :version=`package show version`", + "install:dependencies":"install && cd test-harness && install", + "release":"recipe build/release.boxr", + "format":"cfformat run handlers,models,test-harness/tests/,ModuleConfig.cfc --overwrite", + "format:watch":"cfformat watch handlers,models,test-harness/tests/,ModuleConfig.cfc ./.cfformat.json", + "format:check":"cfformat check handlers,models,test-harness/tests/,ModuleConfig.cfc ./.cfformat.json" + }, + "testbox":{ + "runner":"/tests/runner.cfm" } -} \ No newline at end of file +} diff --git a/build/Build.cfc b/build/Build.cfc index 7c2f696..8e6eb76 100644 --- a/build/Build.cfc +++ b/build/Build.cfc @@ -2,249 +2,330 @@ * Build process for ColdBox Modules * Adapt to your needs. */ -component{ - - /** - * Constructor - */ - function init(){ - // Setup Pathing - variables.cwd = getCWD().reReplace( "\.$", "" ); - variables.artifactsDir = cwd & "/.artifacts"; - variables.buildDir = cwd & "/.tmp"; - variables.apiDocsURL = "http://localhost:60299/apidocs/"; - variables.testRunner = "http://localhost:60299/tests/runner.cfm"; - - // Source Excludes Not Added to final binary - variables.excludes = [ - ".gitignore", - ".travis.yml", - ".artifacts", - ".tmp", - "build", - "test-harness", - ".DS_Store", - ".git" - ]; - - // Cleanup + Init Build Directories - [ variables.buildDir, variables.artifactsDir ].each( function( item ){ - if( directoryExists( item ) ){ - directoryDelete( item, true ); - } - // Create directories - directoryCreate( item, true, true ); +component { + + /** + * Constructor + */ + function init(){ + // Setup Pathing + variables.cwd = getCWD().reReplace( "\.$", "" ); + variables.artifactsDir = cwd & "/.artifacts"; + variables.buildDir = cwd & "/.tmp"; + variables.apiDocsURL = "http://localhost:60299/apidocs/"; + variables.testRunner = "http://localhost:60299/tests/runner.cfm"; + + // Source Excludes Not Added to final binary + variables.excludes = [ + "build", + "node-modules", + "resources", + "test-harness", + "(package|package-lock).json", + "webpack.config.js", + "server-.*\.json", + "docker-compose.yml", + "^\..*" + ]; + + // Cleanup + Init Build Directories + [ + variables.buildDir, + variables.artifactsDir + ].each( function( item ){ + if ( directoryExists( item ) ) { + directoryDelete( item, true ); + } + // Create directories + directoryCreate( item, true, true ); } ); // Create Mappings - fileSystemUtil.createMapping( "coldbox", variables.cwd & "test-harness/coldbox" ); - - return this; - } - - /** - * 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 - */ - function run( - required projectName, - version="1.0.0", - buildID=createUUID(), - branch="development" - ){ - - // Run the tests - runTests(); - - // Build the source - buildSource( argumentCollection=arguments ); - - // Build Docs - arguments.outputDir = variables.buildDir & "/apidocs"; - docs( argumentCollection=arguments ); - - // checksums - buildChecksums(); - - // Finalize Message - print.line() - .boldMagentaLine( "Build Process is done! Enjoy your build!" ) - .toConsole(); - } - - /** - * Run the test suites - */ - function runTests(){ - // Tests First, if they fail then exit - print.blueLine( "Testing the package, please wait..." ).toConsole(); - - command( 'testbox run' ) - .params( - runner = variables.testRunner, - verbose = true, - outputFile = "build/results.json" - ) - .run(); - - // Check Exit Code? - if( shell.getExitCode() ){ - return error( "Cannot continue building, tests failed!" ); - } - } - - /** - * Build the source + fileSystemUtil.createMapping( + "coldbox", + variables.cwd & "test-harness/coldbox" + ); + + return this; + } + + /** + * 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 - */ - function buildSource( - required projectName, - version="1.0.0", - buildID=createUUID(), - branch="development" - ){ - // Stable builds are 1.2.3+56 while unstable builds are 1.2.3-snapshot - if( arguments.branch == "master" ) { - arguments.version &= '+#arguments.buildID#'; - } else { - arguments.version &= '-snapshot'; + * @version The version you are building + * @buldID The build identifier + * @branch The branch you are building + */ + function run( + required projectName, + version = "1.0.0", + buildID = createUUID(), + branch = "development" + ){ + // Create project mapping + fileSystemUtil.createMapping( arguments.projectName, variables.cwd ); + + // Build the source + buildSource( argumentCollection = arguments ); + + // Build Docs + arguments.outputDir = variables.buildDir & "/apidocs"; + docs( argumentCollection = arguments ); + + // checksums + buildChecksums(); + + // Build latest changelog + latestChangelog(); + + // Finalize Message + print + .line() + .boldMagentaLine( "Build Process is done! Enjoy your build!" ) + .toConsole(); + } + + /** + * Run the test suites + */ + function runTests(){ + // Tests First, if they fail then exit + print.blueLine( "Testing the package, please wait..." ).toConsole(); + + command( "testbox run" ) + .params( + runner = variables.testRunner, + verbose = true, + outputFile = "#variables.cwd#/test-harness/results/test-results", + outputFormats="json,antjunit" + ) + .run(); + + // Check Exit Code? + if ( shell.getExitCode() ) { + return error( "Cannot continue building, tests failed!" ); + } + } + + /** + * 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 + */ + function buildSource( + required projectName, + version = "1.0.0", + buildID = createUUID(), + branch = "development" + ){ + // Build Notice ID + print + .line() + .boldMagentaLine( + "Building #arguments.projectName# v#arguments.version#+#arguments.buildID# from #cwd# using the #arguments.branch# branch." + ) + .toConsole(); + + ensureExportDir( argumentCollection = arguments ); + + // Project Build Dir + variables.projectBuildDir = variables.buildDir & "/#projectName#"; + directoryCreate( + variables.projectBuildDir, + true, + true + ); + + // Copy source + print.blueLine( "Copying source to build folder..." ).toConsole(); + copy( + variables.cwd, + variables.projectBuildDir + ); + + // Create build ID + fileWrite( + "#variables.projectBuildDir#/#projectName#-#version#+#buildID#", + "Built with love on #dateTimeFormat( now(), "full" )#" + ); + + // Updating Placeholders + print.greenLine( "Updating version identifier to #arguments.version#" ).toConsole(); + command( "tokenReplace" ) + .params( + path = "/#variables.projectBuildDir#/**", + token = "@build.version@", + replacement = arguments.version + ) + .run(); + + print.greenLine( "Updating build identifier to #arguments.buildID#" ).toConsole(); + command( "tokenReplace" ) + .params( + path = "/#variables.projectBuildDir#/**", + token = ( arguments.branch == "master" ? "@build.number@" : "+@build.number@" ), + replacement = ( arguments.branch == "master" ? arguments.buildID : "-snapshot" ) + ) + .run(); + + // zip up source + var destination = "#variables.exportsDir#/#projectName#-#version#.zip"; + print.greenLine( "Zipping code to #destination#" ).toConsole(); + cfzip( + action = "zip", + file = "#destination#", + source = "#variables.projectBuildDir#", + overwrite = true, + recurse = true + ); + + // Copy box.json for convenience + fileCopy( + "#variables.projectBuildDir#/box.json", + variables.exportsDir + ); + } + + /** + * Produce the API Docs + */ + function docs( + required projectName, + version = "1.0.0", + outputDir = ".tmp/apidocs" + ){ + ensureExportDir( argumentCollection = arguments ); + + // Create project mapping + fileSystemUtil.createMapping( arguments.projectName, variables.cwd ); + // Generate Docs + print.greenLine( "Generating API Docs, please wait..." ).toConsole(); + + command( "docbox generate" ) + .params( + "source" = "models", + "mapping" = "models", + "strategy-projectTitle" = "#arguments.projectName# v#arguments.version#", + "strategy-outputDir" = arguments.outputDir + ) + .run(); + + print.greenLine( "API Docs produced at #arguments.outputDir#" ).toConsole(); + + var destination = "#variables.exportsDir#/#projectName#-docs-#version#.zip"; + print.greenLine( "Zipping apidocs to #destination#" ).toConsole(); + cfzip( + action = "zip", + file = "#destination#", + source = "#arguments.outputDir#", + overwrite = true, + recurse = true + ); + } + + /** + * Build the latest changelog file: changelog-latest.md + */ + function latestChangelog(){ + print.blueLine( "Building latest changelog..." ).toConsole(); + + if ( !fileExists( variables.cwd & "changelog.md" ) ) { + return error( "Cannot continue building, changelog.md file doesn't exist!" ); } - print.greenLine( "Updating box.json version to #arguments.version#" ).toConsole(); - command( 'package set' ) - .params( version=arguments.version ) - .run(); - - - // Build Notice ID - print.line() - .boldMagentaLine( "Building #arguments.projectName# v#arguments.version# from #cwd# using the #arguments.branch# branch." ) - .toConsole(); - - // Prepare exports directory - variables.exportsDir = variables.artifactsDir & "/#projectName#/#arguments.version#"; - directoryCreate( variables.exportsDir, true, true ); - - // Project Build Dir - variables.projectBuildDir = variables.buildDir & "/#projectName#"; - directoryCreate( variables.projectBuildDir, true, true ); - - // Copy source - print.blueLine( "Copying source to build folder..." ).toConsole(); - copy( variables.cwd, variables.projectBuildDir ); - - // Create build ID - fileWrite( "#variables.projectBuildDir#/#projectName#-#version#", "Built with love on #dateTimeFormat( now(), "full")#" ); - - // Updating Placeholders - print.greenLine( "Updating version identifier to #arguments.version#" ).toConsole(); - command( 'tokenReplace' ) - .params( - path = "/#variables.projectBuildDir#/**", - token = "@build.version@", - replacement = arguments.version - ) - .run(); - - // zip up source - var destination = "#variables.exportsDir#/#projectName#-#version#.zip"; - print.greenLine( "Zipping code to #destination#" ).toConsole(); - cfzip( - action="zip", - file="#destination#", - source="#variables.projectBuildDir#", - overwrite=true, - recurse=true - ); - - // Copy box.json for convenience - fileCopy( "#variables.projectBuildDir#/box.json", variables.exportsDir ); - } - - /** - * Produce the API Docs - */ - function docs( required projectName, version="1.0.0", outputDir=".tmp/apidocs" ){ - // Generate Docs - print.greenLine( "Generating API Docs, please wait..." ).toConsole(); - directoryCreate( arguments.outputDir, true, true ); - - command( 'docbox generate' ) - .params( - "source" = "models", - "mapping" = "models", - "strategy-projectTitle" = "#arguments.projectName# v#arguments.version#", - "strategy-outputDir" = arguments.outputDir - ) - .run(); - - print.greenLine( "API Docs produced at #arguments.outputDir#" ).toConsole(); - - var destination = "#variables.exportsDir#/#projectName#-docs-#version#.zip"; - print.greenLine( "Zipping apidocs to #destination#" ).toConsole(); - cfzip( - action="zip", - file="#destination#", - source="#arguments.outputDir#", - overwrite=true, - recurse=true - ); - } - - /********************************************* PRIVATE HELPERS *********************************************/ - - /** - * Build Checksums - */ - private function buildChecksums(){ - print.greenLine( "Building checksums" ).toConsole(); - command( 'checksum' ) - .params( path = '#variables.exportsDir#/*.zip', algorithm = 'SHA-512', extension="sha512", write=true ) - .run(); - command( 'checksum' ) - .params( path = '#variables.exportsDir#/*.zip', algorithm = 'md5', extension="md5", write=true ) - .run(); - } - - /** - * DirectoryCopy is broken in lucee - */ - private function copy( src, target, recurse=true ){ - // process paths with excludes - directoryList( src, false, "path", function( path ){ - var isExcluded = false; - variables.excludes.each( function( item ){ - if( path.replaceNoCase( variables.cwd, "", "all" ).findNoCase( item ) ){ - isExcluded = true; - } - } ); - return !isExcluded; - }).each( function( item ){ - // Copy to target - if( fileExists( item ) ){ - print.blueLine( "Copying #item#" ).toConsole(); - fileCopy( item, target ); - } else { - print.greenLine( "Copying directory #item#" ).toConsole(); - directoryCopy( item, target & "/" & item.replace( src, "" ), true ); - } - } ); - } - - /** + fileWrite( + variables.cwd & "changelog-latest.md", + fileRead( variables.cwd & "changelog.md" ).split( "----" )[ 2 ].trim() & chr( 13 ) & chr( 10 ) + ); + + print + .greenLine( "Latest changelog file created at `changelog-latest.md`" ) + .line() + .line( fileRead( variables.cwd & "changelog-latest.md" ) ); + } + + /********************************************* PRIVATE HELPERS *********************************************/ + + /** + * Build Checksums + */ + private function buildChecksums(){ + print.greenLine( "Building checksums" ).toConsole(); + command( "checksum" ) + .params( + path = "#variables.exportsDir#/*.zip", + algorithm = "SHA-512", + extension = "sha512", + write = true + ) + .run(); + command( "checksum" ) + .params( + path = "#variables.exportsDir#/*.zip", + algorithm = "md5", + extension = "md5", + write = true + ) + .run(); + } + + /** + * DirectoryCopy is broken in lucee + */ + private function copy( src, target, recurse = true ){ + // process paths with excludes + directoryList( + src, + false, + "path", + function( path ){ + var isExcluded = false; + variables.excludes.each( function( item ){ + if ( path.replaceNoCase( variables.cwd, "", "all" ).reFindNoCase( item ) ) { + isExcluded = true; + } + } ); + return !isExcluded; + } + ).each( function( item ){ + // Copy to target + if ( fileExists( item ) ) { + print.blueLine( "Copying #item#" ).toConsole(); + fileCopy( item, target ); + } else { + print.greenLine( "Copying directory #item#" ).toConsole(); + directoryCopy( + item, + target & "/" & item.replace( src, "" ), + true + ); + } + } ); + } + + /** * Gets the last Exit code to be used **/ - private function getExitCode() { - return (createObject( 'java', 'java.lang.System' ).getProperty( 'cfml.cli.exitCode' ) ?: 0); - + private function getExitCode(){ + return ( createObject( "java", "java.lang.System" ).getProperty( "cfml.cli.exitCode" ) ?: 0 ); } -} \ No newline at end of file + /** + * Ensure the export directory exists at artifacts/NAME/VERSION/ + */ + private function ensureExportDir( + required projectName, + version = "1.0.0" + ){ + if ( structKeyExists( variables, "exportsDir" ) && directoryExists( variables.exportsDir ) ){ + return; + } + // Prepare exports directory + variables.exportsDir = variables.artifactsDir & "/#projectName#/#arguments.version#"; + directoryCreate( variables.exportsDir, true, true ); + } +} diff --git a/build/SetupTemplate.cfc b/build/SetupTemplate.cfc new file mode 100644 index 0000000..ca18f24 --- /dev/null +++ b/build/SetupTemplate.cfc @@ -0,0 +1,70 @@ +/** + * Setup the Module Template according to your needs + */ +component { + + /** + * Constructor + */ + function init(){ + // Setup Pathing + variables.cwd = getCWD().reReplace( "\.$", "" ); + return this; + } + + /** + * Setup the module template + */ + function run(){ + + // remove old .git + //directoryDelete( variables.cwd & ".git", true ); + + // Create new git repo + //command( "!git init" ).run(); + + var moduleName = ask( "What is the human readable name of your module?" ); + if( !len( moduleName ) ){ + error( "Module Name is required" ); + } + var moduleSlug = ask( "What is the slug for your module?" ); + if( !len( moduleSlug ) ){ + error( "Module Slug is required" ); + } + var moduleDescription = ask( "Short description of your module?" ); + if( !len( moduleDescription ) ){ + error( "Module Description is required" ); + } + + command( "tokenReplace" ) + .params( + path = "/#variables.cwd#/**", + token = "@MODULE_NAME@", + replacement = moduleName + ) + .run(); + + command( "tokenReplace" ) + .params( + path = "/#variables.cwd#/**", + token = "@MODULE_SLUG@", + replacement = moduleSlug + ) + .run(); + + command( "tokenReplace" ) + .params( + path = "/#variables.cwd#/**", + token = "@MODULE_DESCRIPTION@", + replacement = moduleDescription + ) + .run(); + + // Finalize Message + print + .line() + .boldMagentaLine( "Your module template is now ready for development! Just add the github origin, commit some code and Go rock it!" ) + .toConsole(); + } + +} diff --git a/build/toMaster.boxr b/build/release.boxr similarity index 64% rename from build/toMaster.boxr rename to build/release.boxr index adb5d16..e216f22 100755 --- a/build/toMaster.boxr +++ b/build/release.boxr @@ -1,19 +1,25 @@ # This recipe signifies a new release of the module by doing merges and bumps accordingly -# Check out master +# Check out master and update it locally !git checkout -f master -# Merge development into it +!git pull origin master + +# Merge development into it for release !git merge --no-ff development -# Tag the master repo with the version in box.json -echo "git tag v`box package show version`" | run -# Push all branches + +# Tag the master repo with the version from box.json +!git tag v`box package show version` + +# Push all branches back out to github !git push origin --all + # Push all tags !git push origin --tags + # Check development again !git checkout -f development + # Bump to prepare for a new release, do minor, change if needed and don't tag bump --minor --!tagVersion -# Send it out !git commit -a -m "version bump" !git push origin development \ No newline at end of file diff --git a/changelog.md b/changelog.md index 9959727..9b23996 100644 --- a/changelog.md +++ b/changelog.md @@ -1,23 +1,44 @@ # Changelog -## 1.2.0 +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +---- + +## [Unreleased] + +## [2.0.0] + +### Added + +- Migration to github actions +- Migration to new module template + +### Removed + +- ACF2016 Support +- ColdBox 5 Support + +## [1.2.0] - More ACF Compat - New Module's Layout - Spelling Errors -## 1.1.2 +## [1.1.2] - ACF Compat -## 1.1.1 +## [1.1.1] - Fixes to ColdBox Compat for 4 and 5 -## 1.1.0 +## [1.1.0] - ColdBox 4 Compat -## 1.0.0 +## [1.0.0] -- First Release \ No newline at end of file +- First Release diff --git a/handlers/Home.cfc b/handlers/Home.cfc index 1324181..1637186 100644 --- a/handlers/Home.cfc +++ b/handlers/Home.cfc @@ -1,17 +1,11 @@ /** * Visualize system routes */ -component{ +component { function index( event, rc, prc ){ - if( wirebox.containsInstance( name="router@coldbox" ) ){ - var oRouter = controller.getRoutingService().getRouter(); - prc.aModuleRoutes = oRouter.getModuleRoutingTable(); - } else { - var oRouter = getInterceptor( "SES" ); - prc.aModuleRoutes = oRouter.getModulesRoutingTable(); - } - + var oRouter = controller.getRoutingService().getRouter(); + prc.aModuleRoutes = oRouter.getModuleRoutingTable(); prc.aRoutes = oRouter.getRoutes(); prc.aNamespaceRoutes = oRouter.getNamespaceRoutingTable(); diff --git a/readme.md b/readme.md index cdf7eff..b7a12d1 100644 --- a/readme.md +++ b/readme.md @@ -1,3 +1,20 @@ +

+ +
+ + + +

+ +

+ Copyright Since 2005 ColdBox Platform by Luis Majano and Ortus Solutions, Corp +
+ www.coldbox.org | + www.ortussolutions.com +

+ +---- + # Welcome to the ColdBox Route Visualizer The ColdBox Route visualizer will map out all your routing tables for any ColdBox 4+ application. You will visualize the routing and test the routes in the order they fire. @@ -17,12 +34,10 @@ Apache License, Version 2.0. ## SYSTEM REQUIREMENTS - Lucee 5+ -- Adobe ColdFusion 11+ -- ColdBox 4+ - ---- +- Adobe ColdFusion 2018+ +- ColdBox 6+ -# Instructions +## Instructions Just drop into your `modules` folder or use the box-cli to install @@ -30,20 +45,36 @@ Just drop into your `modules` folder or use the box-cli to install Once installed you can now visit the entry point `/route-visualizer` and go :chestnut: visualizing your routes! -******************************************************************************** -Copyright Since 2005 ColdBox Framework by Ortus Solutions, Corp -www.ortussolutions.com -******************************************************************************** +---- + +## Welcome to ColdBox + +ColdBox *Hierarchical* MVC is the de-facto enterprise-level [HMVC](https://en.wikipedia.org/wiki/Hierarchical_model%E2%80%93view%E2%80%93controller) framework for ColdFusion (CFML) developers. It's professionally backed, conventions-based, modular, highly extensible, and productive. Getting started with ColdBox is quick and painless. ColdBox takes the pain out of development by giving you a standardized methodology for modern ColdFusion (CFML) development with features such as: + +* [Conventions instead of configuration](https://coldbox.ortusbooks.com/getting-started/conventions) +* [Modern URL routing](https://coldbox.ortusbooks.com/the-basics/routing) +* [RESTFul APIs](https://coldbox.ortusbooks.com/the-basics/event-handlers/rendering-data) +* [A hierarchical approach to MVC using ColdBox Modules](https://coldbox.ortusbooks.com/hmvc/modules) +* [Event-driven programming](https://coldbox.ortusbooks.com/digging-deeper/interceptors) +* [Async and Parallel programming constructs](https://coldbox.ortusbooks.com/digging-deeper/promises-async-programming) +* [Integration & Unit Testing](https://coldbox.ortusbooks.com/testing/testing-coldbox-applications) +* [Included dependency injection](https://wirebox.ortusbooks.com) +* [Caching engine and API](https://cachebox.ortusbooks.com) +* [Logging engine](https://logbox.ortusbooks.com) +* [An extensive eco-system](https://forgebox.io) +* Much More -#### HONOR GOES TO GOD ABOVE ALL -Because of His grace, this project exists. If you don't like this, then don't read it, its not for you. +## Learning ColdBox ->"Therefore being justified by faith, we have peace with God through our Lord Jesus Christ: -By whom also we have access by faith into this grace wherein we stand, and rejoice in hope of the glory of God. -And not only so, but we glory in tribulations also: knowing that tribulation worketh patience; -And patience, experience; and experience, hope: -And hope maketh not ashamed; because the love of God is shed abroad in our hearts by the -Holy Ghost which is given unto us. ." Romans 5:5 +ColdBox is the defacto standard for building modern ColdFusion (CFML) applications. It has the most extensive [documentation](https://coldbox.ortusbooks.com) of all modern web application frameworks. + + +If you don't like reading so much, then you can try our video learning platform: [CFCasts (www.cfcasts.com)](https://www.cfcasts.com) + +## Ortus Sponsors + +ColdBox is a professional open-source project and it is completely funded by the [community](https://patreon.com/ortussolutions) and [Ortus Solutions, Corp](https://www.ortussolutions.com). Ortus Patreons get many benefits like a cfcasts account, a FORGEBOX Pro account and so much more. If you are interested in becoming a sponsor, please visit our patronage page: [https://patreon.com/ortussolutions](https://patreon.com/ortussolutions) ### THE DAILY BREAD - > "I am the way, and the truth, and the life; no one comes to the Father, but by me (JESUS)" Jn 14:1-12 \ No newline at end of file + + > "I am the way, and the truth, and the life; no one comes to the Father, but by me (JESUS)" Jn 14:1-12 diff --git a/test-harness/server-adobe@2018.json b/server-adobe@2018.json similarity index 55% rename from test-harness/server-adobe@2018.json rename to server-adobe@2018.json index 1d7bbb3..4be8698 100644 --- a/test-harness/server-adobe@2018.json +++ b/server-adobe@2018.json @@ -1,4 +1,5 @@ { + "name":"route-visualizer-adobe@2018", "name":"route-visualizer-adobe@2018", "app":{ "serverHomeDirectory":".engine/adobe2018", @@ -10,7 +11,14 @@ }, "rewrites":{ "enable":"true" + }, + "webroot": "test-harness", + "aliases":{ + "/moduleroot/route-visualizer":"../" } }, - "openBrowser":"false" -} \ No newline at end of file + "openBrowser":"false", + "cfconfig": { + "file" : ".cfconfig.json" + } +} diff --git a/server-adobe@2021.json b/server-adobe@2021.json new file mode 100644 index 0000000..70a36e5 --- /dev/null +++ b/server-adobe@2021.json @@ -0,0 +1,29 @@ +{ + "name":"route-visualizer-adobe@2021", + "app":{ + "serverHomeDirectory":".engine/adobe2021", + "cfengine":"adobe@2021" + }, + "web":{ + "http":{ + "port":"60299" + }, + "rewrites":{ + "enable":"true" + }, + "webroot": "test-harness", + "aliases":{ + "/moduleroot/route-visualizer":"../" + } + }, + "jvm":{ + "heapSize":"1024" + }, + "openBrowser":"false", + "cfconfig": { + "file" : ".cfconfig.json" + }, + "scripts" : { + "onServerInstall":"cfpm install zip,debugger" + } +} diff --git a/test-harness/server-lucee@5.json b/server-lucee@5.json similarity index 60% rename from test-harness/server-lucee@5.json rename to server-lucee@5.json index f4efa4c..02bd8d1 100644 --- a/test-harness/server-lucee@5.json +++ b/server-lucee@5.json @@ -10,7 +10,14 @@ }, "rewrites":{ "enable":"true" + }, + "webroot": "test-harness", + "aliases":{ + "/moduleroot/route-visualizer":"../" } }, - "openBrowser":"false" -} \ No newline at end of file + "openBrowser":"false", + "cfconfig": { + "file" : ".cfconfig.json" + } +} diff --git a/test-harness/.cfconfig.json b/test-harness/.cfconfig.json deleted file mode 100644 index bd49f5d..0000000 --- a/test-harness/.cfconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "debuggingEnabled":true, - "debuggingReportExecutionTimes":false, - "disableInternalCFJavaComponents":false, - "inspectTemplate":"always", - "requestTimeout":"0,0,0,90", - "robustExceptionEnabled":true -} \ No newline at end of file diff --git a/test-harness/.cflintrc b/test-harness/.cflintrc deleted file mode 100644 index 9e26dfe..0000000 --- a/test-harness/.cflintrc +++ /dev/null @@ -1 +0,0 @@ -{} \ No newline at end of file diff --git a/test-harness/Application.cfc b/test-harness/Application.cfc index 2200100..095f23a 100644 --- a/test-harness/Application.cfc +++ b/test-harness/Application.cfc @@ -75,4 +75,4 @@ component{ return application.cbBootstrap.onMissingTemplate( argumentCollection=arguments ); } -} \ No newline at end of file +} diff --git a/test-harness/config/Coldbox.cfc b/test-harness/config/Coldbox.cfc index 0642181..d35b065 100644 --- a/test-harness/config/Coldbox.cfc +++ b/test-harness/config/Coldbox.cfc @@ -26,7 +26,7 @@ //Error/Exception Handling exceptionHandler = "", onInvalidEvent = "", - customErrorTemplate = "/coldbox/system/includes/BugReport.cfm", + customErrorTemplate = "/coldbox/system/exceptions/Whoops.cfm", //Application Aspects handlerCaching = false, @@ -50,15 +50,15 @@ //Register interceptors as an array, we need order interceptors = [ - //SES - { class="coldbox.system.interceptors.SES" } ]; //LogBox DSL logBox = { // Define Appenders appenders = { - files={class="coldbox.system.logging.appenders.RollingFileAppender", + myConsole : { class : "ConsoleAppender" }, + files : { + class="RollingFileAppender", properties = { filename = "tester", filePath="/#appMapping#/logs" } @@ -76,6 +76,7 @@ * Load the Module you are testing */ function afterAspectsLoad( event, interceptData, rc, prc ){ + controller.getModuleService() .registerAndActivateModule( moduleName = request.MODULE_NAME, @@ -83,4 +84,4 @@ ); } -} \ No newline at end of file +} diff --git a/test-harness/config/Router.cfc b/test-harness/config/Router.cfc new file mode 100755 index 0000000..81aefde --- /dev/null +++ b/test-harness/config/Router.cfc @@ -0,0 +1,9 @@ +component{ + + function configure(){ + setFullRewrites( true ); + + route( ":handler/:action?" ).end(); + } + +} \ No newline at end of file diff --git a/test-harness/config/Routes.cfm b/test-harness/config/Routes.cfm deleted file mode 100644 index a304d25..0000000 --- a/test-harness/config/Routes.cfm +++ /dev/null @@ -1,46 +0,0 @@ - - // Allow unique URL or combination of URLs, we recommend both enabled - setUniqueURLS(false); - // Auto reload configuration, true in dev makes sense to reload the routes on every request - //setAutoReload(false); - // Sets automatic route extension detection and places the extension in the rc.format variable - // setExtensionDetection(true); - // The valid extensions this interceptor will detect - // setValidExtensions('xml,json,jsont,rss,html,htm'); - // If enabled, the interceptor will throw a 406 exception that an invalid format was detected or just ignore it - // setThrowOnInvalidExtension(true); - - // Base URL - if( len(getSetting('AppMapping') ) lte 1){ - setBaseURL("http://#cgi.HTTP_HOST#/"); - } - else{ - setBaseURL("http://#cgi.HTTP_HOST#/#getSetting('AppMapping')#/"); - } - - // Your Application Routes - addRoute(pattern=":handler/:action?"); - - - /** Developers can modify the CGI.PATH_INFO value in advance of the SES - interceptor to do all sorts of manipulations in advance of route - detection. If provided, this function will be called by the SES - interceptor instead of referencing the value CGI.PATH_INFO. - - This is a great place to perform custom manipulations to fix systemic - URL issues your Web site may have or simplify routes for i18n sites. - - @Event The ColdBox RequestContext Object - **/ - function PathInfoProvider(Event){ - /* Example: - var URI = CGI.PATH_INFO; - if (URI eq "api/foo/bar") - { - Event.setProxyRequest(true); - return "some/other/value/for/your/routes"; - } - */ - return CGI.PATH_INFO; - } - \ No newline at end of file diff --git a/test-harness/config/WireBox.cfc b/test-harness/config/WireBox.cfc deleted file mode 100644 index 3aafc01..0000000 --- a/test-harness/config/WireBox.cfc +++ /dev/null @@ -1,46 +0,0 @@ -component extends="coldbox.system.ioc.config.Binder"{ - - /** - * Configure WireBox, that's it! - */ - function configure(){ - - // The WireBox configuration structure DSL - wireBox = { - // Scope registration, automatically register a wirebox injector instance on any CF scope - // By default it registeres itself on application scope - scopeRegistration = { - enabled = true, - scope = "application", // server, cluster, session, application - key = "wireBox" - }, - - // DSL Namespace registrations - customDSL = { - // namespace = "mapping name" - }, - - // Custom Storage Scopes - customScopes = { - // annotationName = "mapping name" - }, - - // Package scan locations - scanLocations = [], - - // Stop Recursions - stopRecursions = [], - - // Parent Injector to assign to the configured injector, this must be an object reference - parentInjector = "", - - // Register all event listeners here, they are created in the specified order - listeners = [ - // { class="", name="", properties={} } - ] - }; - - // Map Bindings below - } - -} \ No newline at end of file diff --git a/test-harness/layouts/Main.cfm b/test-harness/layouts/Main.cfm index f8894ef..b50f9ab 100644 --- a/test-harness/layouts/Main.cfm +++ b/test-harness/layouts/Main.cfm @@ -1,6 +1,6 @@ 

Module Tester

- #renderView()# + #view()#
-
\ No newline at end of file + diff --git a/test-harness/main/index.cfm b/test-harness/main/index.cfm new file mode 100644 index 0000000..992cabe --- /dev/null +++ b/test-harness/main/index.cfm @@ -0,0 +1,3 @@ + +Module Tester + \ No newline at end of file diff --git a/test-harness/server-adobe@11.json b/test-harness/server-adobe@11.json deleted file mode 100644 index 74210c2..0000000 --- a/test-harness/server-adobe@11.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name":"route-visualizer-adobe@11", - "app":{ - "serverHomeDirectory":".engine/adobe11", - "cfengine":"adobe@11" - }, - "web":{ - "http":{ - "port":"60299" - }, - "rewrites":{ - "enable":"true" - } - }, - "openBrowser":"false" -} \ No newline at end of file diff --git a/test-harness/server-adobe@2016.json b/test-harness/server-adobe@2016.json deleted file mode 100644 index d9886b9..0000000 --- a/test-harness/server-adobe@2016.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name":"route-visualizer-adobe@2016", - "app":{ - "serverHomeDirectory":".engine/adobe2016", - "cfengine":"adobe@2016" - }, - "web":{ - "http":{ - "port":"60299" - }, - "rewrites":{ - "enable":"true" - } - }, - "openBrowser":"false" -} \ No newline at end of file diff --git a/test-harness/server-lucee@45.json b/test-harness/server-lucee@45.json deleted file mode 100644 index ed64076..0000000 --- a/test-harness/server-lucee@45.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name":"route-visualizer-lucee@45", - "app":{ - "serverHomeDirectory":".engine/lucee45", - "cfengine":"lucee@4.5" - }, - "web":{ - "http":{ - "port":"60299" - }, - "rewrites":{ - "enable":"true" - } - }, - "openBrowser":"false" -} \ No newline at end of file diff --git a/test-harness/tests/Application.cfc b/test-harness/tests/Application.cfc index 8447b67..c8a0b7f 100644 --- a/test-harness/tests/Application.cfc +++ b/test-harness/tests/Application.cfc @@ -1,31 +1,85 @@ /** -******************************************************************************** -Copyright 2005-2007 ColdBox Framework by Luis Majano and Ortus Solutions, Corp -www.ortussolutions.com -******************************************************************************** +* Copyright 2005-2007 ColdBox Framework by Luis Majano and Ortus Solutions, Corp +* www.ortussolutions.com +* --- */ component{ - // UPDATE THE NAME OF THE MODULE IN TESTING BELOW + // The name of the module used in cfmappings ,etc request.MODULE_NAME = "route-visualizer"; + // The directory name of the module on disk. Usually, it's the same as the module name + request.MODULE_PATH = "route-visualizer"; // APPLICATION CFC PROPERTIES - this.name = "ColdBoxTestingSuite" & hash(getCurrentTemplatePath()); + this.name = "#request.MODULE_NAME# Testing Suite"; this.sessionManagement = true; this.sessionTimeout = createTimeSpan( 0, 0, 15, 0 ); this.applicationTimeout = createTimeSpan( 0, 0, 15, 0 ); this.setClientCookies = true; + // Turn on/off white space management + this.whiteSpaceManagement = "smart"; + this.enableNullSupport = shouldEnableFullNullSupport(); // Create testing mapping this.mappings[ "/tests" ] = getDirectoryFromPath( getCurrentTemplatePath() ); // The application root rootPath = REReplaceNoCase( this.mappings[ "/tests" ], "tests(\\|/)", "" ); - this.mappings[ "/root" ] = rootPath; + this.mappings[ "/root" ] = rootPath; // The module root path - moduleRootPath = REReplaceNoCase( this.mappings[ "/root" ], "#request.module_name#(\\|/)test-harness(\\|/)", "" ); - this.mappings[ "/moduleroot" ] = moduleRootPath; - this.mappings[ "/#request.MODULE_NAME#" ] = moduleRootPath & "#request.MODULE_NAME#"; + moduleRootPath = REReplaceNoCase( rootPath, "#request.MODULE_PATH#(\\|/)test-harness(\\|/)", "" ); + this.mappings[ "/moduleroot" ] = moduleRootPath; + this.mappings[ "/#request.MODULE_NAME#" ] = moduleRootPath & "#request.MODULE_PATH#"; -} \ No newline at end of file + // ORM Definitions + /** + this.datasource = "coolblog"; + this.ormEnabled = "true"; + this.ormSettings = { + cfclocation = [ "/root/models" ], + logSQL = true, + dbcreate = "update", + secondarycacheenabled = false, + cacheProvider = "ehcache", + flushAtRequestEnd = false, + eventhandling = true, + eventHandler = "cborm.models.EventHandler", + skipcfcWithError = false + }; + **/ + + function onRequestStart( required targetPage ){ + + // Set a high timeout for long running tests + setting requestTimeout="9999"; + // New ColdBox Virtual Application Starter + request.coldBoxVirtualApp = new coldbox.system.testing.VirtualApp( appMapping = "/root" ); + + // If hitting the runner or specs, prep our virtual app + if ( getBaseTemplatePath().replace( expandPath( "/tests" ), "" ).reFindNoCase( "(runner|specs)" ) ) { + request.coldBoxVirtualApp.startup(); + } + + // ORM Reload for fresh results + if( structKeyExists( url, "fwreinit" ) ){ + if( structKeyExists( server, "lucee" ) ){ + pagePoolClear(); + } + // ormReload(); + request.coldBoxVirtualApp.restart(); + } + + return true; + } + + public void function onRequestEnd( required targetPage ) { + request.coldBoxVirtualApp.shutdown(); + } + + private boolean function shouldEnableFullNullSupport() { + var system = createObject( "java", "java.lang.System" ); + var value = system.getEnv( "FULL_NULL" ); + return isNull( value ) ? false : !!value; + } +} diff --git a/test-harness/tests/specs/MainTests.cfc b/test-harness/tests/specs/MainTests.cfc index 1284b6f..062a2cd 100644 --- a/test-harness/tests/specs/MainTests.cfc +++ b/test-harness/tests/specs/MainTests.cfc @@ -1,4 +1,4 @@ -component extends="coldbox.system.testing.BaseTestCase"{ +component extends="coldbox.system.testing.BaseTestCase" { /*********************************** LIFE CYCLE Methods ***********************************/ @@ -11,30 +11,15 @@ super.afterAll(); } - - function get( - string route = "", - struct params = {}, - struct headers = {}, - boolean renderResults = true - ) { - arguments.method = "GET"; - return variables.request( argumentCollection = arguments ); - } - -/*********************************** BDD SUITES ***********************************/ + /*********************************** BDD SUITES ***********************************/ function run(){ - describe( "Route Visualizer", function(){ - it( "can render out", function(){ - var event = get( "/route-visualizer" ); - expect( event.getRenderedContent() ).toINclude( "ColdBox Route Visualizer" ); - }); - - }); - + var event = this.get( "/route-visualizer" ); + expect( event.getRenderedContent() ).toInclude( "ColdBox Route Visualizer" ); + } ); + } ); } -} \ No newline at end of file +} diff --git a/views/home/index.cfm b/views/home/index.cfm index 370dfd3..e83ba07 100644 --- a/views/home/index.cfm +++ b/views/home/index.cfm @@ -7,7 +7,7 @@ -#renderView( +#view( view = "home/routeTable", args = { routes = prc.aRoutes, type = "root" } )# From 2b7128b15df742db522177ef60d1429352db5e9b Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Mon, 27 Mar 2023 17:34:28 +0200 Subject: [PATCH 3/5] updated runner location --- box.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/box.json b/box.json index 4102c8e..d04c98e 100644 --- a/box.json +++ b/box.json @@ -37,6 +37,6 @@ "format:check":"cfformat check handlers,models,test-harness/tests/,ModuleConfig.cfc ./.cfformat.json" }, "testbox":{ - "runner":"/tests/runner.cfm" + "runner":"http://localhost:60299/tests/runner.cfm" } } From f5048435357731fbcd16b3c3506790fb6b6a2afa Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Mon, 27 Mar 2023 17:37:25 +0200 Subject: [PATCH 4/5] updated dependencies --- test-harness/box.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test-harness/box.json b/test-harness/box.json index a231683..b64ca02 100644 --- a/test-harness/box.json +++ b/test-harness/box.json @@ -5,10 +5,10 @@ "private":true, "description":"", "dependencies":{ - "coldbox":"^5.0.0" + "coldbox":"^6.0.0" }, "devDependencies":{ - "testbox":"^2.8.0" + "testbox":"^4.0.0" }, "installPaths":{ "coldbox":"coldbox/", @@ -17,4 +17,4 @@ "testbox":{ "runner":"http://localhost:60299/tests/runner.cfm" } -} \ No newline at end of file +} From 54dbc5a427e138c1e4d5f38b6461a01c9a5c5f8d Mon Sep 17 00:00:00 2001 From: Luis Majano Date: Mon, 27 Mar 2023 17:58:17 +0200 Subject: [PATCH 5/5] fixed routing --- ModuleConfig.cfc | 3 +++ server-lucee@5.json | 10 +++++----- test-harness/handlers/Main.cfc | 4 ++-- test-harness/main/index.cfm | 3 --- test-harness/views/main/index.cfm | 3 +++ 5 files changed, 13 insertions(+), 10 deletions(-) delete mode 100644 test-harness/main/index.cfm create mode 100644 test-harness/views/main/index.cfm diff --git a/ModuleConfig.cfc b/ModuleConfig.cfc index 0d9d54f..9e16b13 100644 --- a/ModuleConfig.cfc +++ b/ModuleConfig.cfc @@ -30,6 +30,9 @@ component { // module settings - stored in modules.name.settings settings = {}; + // Home Route + router.route( "/" ).to( "Home.index" ); + // Layout Settings layoutSettings = { defaultLayout : "Main.cfm" }; } diff --git a/server-lucee@5.json b/server-lucee@5.json index 02bd8d1..8cc033e 100644 --- a/server-lucee@5.json +++ b/server-lucee@5.json @@ -11,13 +11,13 @@ "rewrites":{ "enable":"true" }, - "webroot": "test-harness", - "aliases":{ + "webroot":"test-harness", + "aliases":{ "/moduleroot/route-visualizer":"../" } }, "openBrowser":"false", - "cfconfig": { - "file" : ".cfconfig.json" - } + "cfconfig":{ + "file":".cfconfig.json" + } } diff --git a/test-harness/handlers/Main.cfc b/test-harness/handlers/Main.cfc index 4d8e3f0..cb8ccba 100644 --- a/test-harness/handlers/Main.cfc +++ b/test-harness/handlers/Main.cfc @@ -2,7 +2,7 @@ function index( event, rc, prc ){ - return "

Go to the Route Visualizer Here!

"; + event.setView( "main/index" ); } -} \ No newline at end of file +} diff --git a/test-harness/main/index.cfm b/test-harness/main/index.cfm deleted file mode 100644 index 992cabe..0000000 --- a/test-harness/main/index.cfm +++ /dev/null @@ -1,3 +0,0 @@ - -Module Tester - \ No newline at end of file diff --git a/test-harness/views/main/index.cfm b/test-harness/views/main/index.cfm new file mode 100644 index 0000000..f6d52a4 --- /dev/null +++ b/test-harness/views/main/index.cfm @@ -0,0 +1,3 @@ + +

Go to the Route Visualizer Here!

+