diff --git a/test-harness/.cfconfig.json b/.cfconfig.json similarity index 100% rename from test-harness/.cfconfig.json rename to .cfconfig.json diff --git a/.cfformat.json b/.cfformat.json index 0233515..443ef67 100644 --- a/.cfformat.json +++ b/.cfformat.json @@ -1,13 +1,14 @@ { "array.empty_padding": false, "array.padding": true, - "array.multiline.min_length": 40, + "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, @@ -17,22 +18,22 @@ "function_call.multiline.leading_comma.padding": true, "function_call.casing.builtin": "cfdocs", "function_call.casing.userdefined": "camel", - "function_call.multiline.element_count": 2, + "function_call.multiline.element_count": 3, "function_call.multiline.leading_comma": false, - "function_call.multiline.min_length": 40, + "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": 2, - "function_declaration.multiline.min_length": 40, + "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": 2, + "function_anonymous.multiline.element_count": 3, "function_anonymous.multiline.leading_comma": false, "function_anonymous.multiline.leading_comma.padding": true, - "function_anonymous.multiline.min_length": 40, + "function_anonymous.multiline.min_length": 50, "function_anonymous.padding": true, "indent_size": 4, "keywords.block_to_keyword_spacing": "spaced", @@ -41,13 +42,13 @@ "keywords.spacing_to_block": "spaced", "keywords.spacing_to_group": true, "keywords.empty_group_spacing": false, - "max_columns": 120, + "max_columns": 115, "metadata.multiline.element_count": 3, - "metadata.multiline.min_length": 40, + "metadata.multiline.min_length": 50, "method_call.chain.multiline" : 3, "newline":"\n", "property.multiline.element_count": 3, - "property.multiline.min_length": 40, + "property.multiline.min_length": 30, "parentheses.padding": true, "strings.quote": "double", "strings.attributes.quote": "double", @@ -57,6 +58,6 @@ "struct.multiline.leading_comma": false, "struct.multiline.leading_comma.padding": true, "struct.multiline.element_count": 2, - "struct.multiline.min_length": 40, + "struct.multiline.min_length": 60, "tab_indent": true -} \ No newline at end of file +} 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/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..dff8226 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,110 @@ +name: cbmarkdown CI + +# Only on Development we build snapshots +on: + push: + branches: + - development + - master + +env: + MODULE_ID: cbmarkdown + +jobs: + ############################################# + # Tests First baby! We fail, no build :( + ############################################# + tests: + uses: ./.github/workflows/tests.yml + secrets: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + + ############################################# + # Build Module + ############################################# + build: + name: Build & Publish + needs: tests + runs-on: ubuntu-20.04 + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Setup Java + uses: actions/setup-java@v2 + with: + distribution: "adopt" + java-version: "11" + + - name: Setup CommandBox + uses: Ortus-Solutions/setup-commandbox@main + 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@v2 + 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 + 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..5193ae5 --- /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@v2 + - uses: taiki-e/create-gh-release-action@v1.5.0 + 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..5da1b04 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,27 @@ +name: Pull Requests + +on: + pull_request: + branches: + - development + +jobs: + tests: + uses: coldbox-modules/cbmarkdown/.github/workflows/tests.yml@development + + # Format PR + format: + name: Format + runs-on: ubuntu-20.04 + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - uses: Ortus-Solutions/commandbox-action@v1.0.2 + with: + cmd: run-script format + + - name: Commit Format Changes + uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: Apply cfformat changes diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..ba6eddd --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,101 @@ +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@2016", "adobe@2018", "adobe@2021" ] + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Setup Java + uses: actions/setup-java@v2 + with: + distribution: "adopt" + java-version: "11" + + - name: Setup Environment For Testing Process + run: | + # Setup .env + touch .env + # ENV + printf "ENVIRONMENT=development\n" >> .env + + - name: Setup CommandBox CLI + uses: Ortus-Solutions/setup-commandbox@main + + - name: Install 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 + # Install Adobe 2021 cfpm modules + if [[ "${{ matrix.cfengine }}" == "adobe@2021" ]] ; then + box run-script install:2021 + fi + 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 + ls -lR test-harness/tests + + - name: Publish Test Results + uses: EnricoMi/publish-unit-test-result-action@v1 + if: always() + with: + files: test-harness/tests/results/**/*.xml + check_name: "${{ matrix.cfengine }} Test Results" + + - name: Upload Test Results to Artifacts + if: always() + uses: actions/upload-artifact@v2 + with: + name: test-results-${{ matrix.cfengine }} + path: | + test-harness/tests/results/**/* + + - name: Failure Debugging Log + if: ${{ failure() }} + run: | + box server log serverConfigFile="server-${{ matrix.cfengine }}.json" + + - name: Upload Debugging Log To Artifacts + if: ${{ failure() }} + uses: actions/upload-artifact@v2 + 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 ddc3087..3a96469 100644 --- a/.gitignore +++ b/.gitignore @@ -1,14 +1,21 @@ -.vscode - +# Artifacts and temp folders .artifacts/** .tmp/** -test-harness/.engine/** +# Engine + Secrets + databases +.env +.engine/** +.db/** + +# 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/ModuleConfig.cfc b/ModuleConfig.cfc index c89936b..fc0d430 100644 --- a/ModuleConfig.cfc +++ b/ModuleConfig.cfc @@ -12,7 +12,7 @@ component { this.author = "Ortus Solutions, Corp"; this.webURL = "http://www.ortussolutions.com/products/codexwiki"; this.description = "Markdown processor for ColdBox applications"; - this.version = "3.3.0+35"; + 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; // If true, looks for layouts in the parent first, if not found, then in module. Else vice-versa @@ -28,25 +28,31 @@ component { function configure(){ settings = { // Looks for www or emails and converts them to links - autoLinkUrls : true, + autoLinkUrls : true, // Creates anchor links for headings - anchorLinks : true, + anchorLinks : true, // Set the anchor id - anchorSetId : true, + anchorSetId : true, // Set the anchor id but also the name - achorSetName : true, + achorSetName : true, // Do we create the anchor for the full header or just before it. True is wrap, false is just create anchor tag - anchorWrapText : false, + anchorWrapText : false, // The class(es) to apply to the anchor - anchorClass : "anchor", + anchorClass : "anchor", // raw html prefix. Added before heading text, wrapped or unwrapped - anchorPrefix : "", + anchorPrefix : "", // raw html suffix. Added before heading text, wrapped or unwrapped - anchorSuffix : "", + anchorSuffix : "", // Enable youtube embedded link transformer - enableYouTubeTransformer : false, + enableYouTubeTransformer : false, + // default null, custom inline code open HTML + codeStyleHTMLOpen : "", + // default null, custom inline code close HTML + codeStyleHTMLClose : "", + // default "language-", prefix used for generating the class for a fenced code block, only used if info is not empty and language is not defined in + fencedCodeLanguageClassPrefix : "language-", // Table options - tableOptions : { + tableOptions : { // Treat consecutive pipes at the end of a column as defining spanning column. columnSpans : true, // Whether table body columns should be at least the number or header columns. diff --git a/box.json b/box.json index e9bf3da..a7a64a2 100644 --- a/box.json +++ b/box.json @@ -1,7 +1,7 @@ { "name":"ColdBox Markdown", - "version":"3.4.0", - "location":"http://downloads.ortussolutions.com/ortussolutions/coldbox-modules/cbmarkdown/@build.version@/cbmarkdown-@build.version@.zip", + "version":"3.5.0", + "location":"https://downloads.ortussolutions.com/ortussolutions/coldbox-modules/cbmarkdown/@build.version@/cbmarkdown-@build.version@.zip", "author":"Ortus Solutions.com ", "slug":"cbmarkdown", "type":"modules", @@ -22,16 +22,31 @@ "dependencies":{ "cbjavaloader":"^2.0.0", "cbemoji":"^1.0.1" + }, + "devDependencies":{ + "commandbox-cfformat":"*", + "commandbox-docbox":"*", + "commandbox-dotenv":"*", + "commandbox-cfconfig":"*" }, "ignore":[ "**/.*", - "tests", - "*/.md" + "test-harness", + "/server*.json" ], + "testbox":{ + "runner":"http://localhost:60299/tests/runner.cfm" + }, "scripts":{ + "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`", "release":"recipe build/release.boxr", - "format":"cfformat run models/,test-harness/tests/,*.cfc --overwrite", - "format:watch":"cfformat watch models/,test-harness/tests/,*.cfc ./.cfformat.json", - "format:check":"cfformat check models/,test-harness/tests/,*.cfc" + "format":"cfformat run models,test-harness/**/*.cfc,ModuleConfig.cfc --overwrite", + "format:watch":"cfformat watch models,test-harness/**/*.cfc,ModuleConfig.cfc ./.cfformat.json", + "format:check":"cfformat check models,test-harness/**/*.cfc,ModuleConfig.cfc", + "cfpm":"echo '\".engine/adobe2021/WEB-INF/cfusion/bin/cfpm.sh\"' | run", + "cfpm:install":"echo '\".engine/adobe2021/WEB-INF/cfusion/bin/cfpm.sh\" install ${1}' | run", + "install:2021":"run-script cfpm:install zip,debugger", + "install:dependencies":"install && cd test-harness && install" } -} \ No newline at end of file +} diff --git a/.travis.yml b/build/.travis.yml similarity index 100% rename from .travis.yml rename to build/.travis.yml diff --git a/build/Build.cfc b/build/Build.cfc index 20d86e4..926cce1 100644 --- a/build/Build.cfc +++ b/build/Build.cfc @@ -2,247 +2,317 @@ * 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" - ){ + 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" + ){ // Create project mapping fileSystemUtil.createMapping( arguments.projectName, variables.cwd ); - // 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 + // 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(); - - // 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#+#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" ){ - // 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 ); - } - } ); - } - - /** + * @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(); + + // 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#+#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" + ){ + // Create project mapping + fileSystemUtil.createMapping( arguments.projectName, variables.cwd ); + // 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 + ); + } + + /** + * 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!" ); + } + + 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 +} diff --git a/changelog.md b/changelog.md index 75ce071..686fdb1 100644 --- a/changelog.md +++ b/changelog.md @@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ---- +## [3.5.0] => 2022-MAY-18 + +### Added + +* New module template updates +* Add options for configuring code blocks and how they render thanks to @michaelborn +* Migration to github actions + +---- + ## [3.4.0] => 2020-MAY-28 ### Added @@ -21,7 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * New TaskList extension * New Strikethrough extension * New Subscript extension - + ---- ## [3.3.0] => 2019-DEC-13 @@ -67,4 +77,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [1.0.0] -* Create first module version \ No newline at end of file +* Create first module version diff --git a/models/Processor.cfc b/models/Processor.cfc index 3e0dae3..8de9401 100644 --- a/models/Processor.cfc +++ b/models/Processor.cfc @@ -3,8 +3,9 @@ * Copyright 2013 Ortus Solutions, Corp * www.ortussolutions.com * --- - * @author Luis Majano * Convert markdown to HTML via the MarkdownJ Java library + * + * @author Luis Majano */ component accessors=true singleton { @@ -24,15 +25,12 @@ component accessors=true singleton { /** * Constructor * - * @javaLoader The javaloader class + * @javaLoader The javaloader class * @javaLoader.inject loader@cbjavaloader - * @options The module options - * @options.inject coldbox:modulesettings:cbmarkdown + * @options The module options + * @options.inject coldbox:modulesettings:cbmarkdown */ - function init( - required javaloader, - required struct options - ){ + function init( required javaloader, required struct options ){ // store references variables.javaloader = arguments.javaLoader; variables.StaticParser = javaloader.create( "com.vladsch.flexmark.parser.Parser" ); @@ -51,6 +49,7 @@ component accessors=true singleton { /** * Convert markdown to HTML + * * @txt The markdown text to convert */ function toHTML( required txt ){ @@ -60,6 +59,7 @@ component accessors=true singleton { /** * Convert HTML to Markdown + * * @html The html to convert to markdown */ function toMarkdown( required html ){ @@ -71,7 +71,7 @@ component accessors=true singleton { * * @options A struct of options for the parser. * - * @return A parser options object. + * @return A parser options object. */ private function createOptions( required struct options ){ var staticTableExtension = javaloader.create( "com.vladsch.flexmark.ext.tables.TablesExtension" ); @@ -79,7 +79,9 @@ component accessors=true singleton { var extensionsToLoad = [ staticTableExtension.create(), - javaloader.create( "com.vladsch.flexmark.ext.gfm.strikethrough.StrikethroughSubscriptExtension" ).create(), + javaloader + .create( "com.vladsch.flexmark.ext.gfm.strikethrough.StrikethroughSubscriptExtension" ) + .create(), javaloader.create( "com.vladsch.flexmark.ext.gfm.tasklist.TaskListExtension" ).create(), javaloader.create( "com.vladsch.flexmark.ext.toc.TocExtension" ).create() ]; @@ -107,82 +109,49 @@ component accessors=true singleton { // Autolink + Anchor Link Options .set( variables.StaticParser.WWW_AUTO_LINK_ELEMENT, - javacast( - "boolean", - arguments.options.autoLinkUrls - ) - ) - .set( - anchorLinkExtension.ANCHORLINKS_SET_ID, - javacast( - "boolean", - arguments.options.anchorSetId - ) - ) - .set( - anchorLinkExtension.ANCHORLINKS_SET_NAME, - javacast( - "boolean", - arguments.options.achorSetName - ) + javacast( "boolean", arguments.options.autoLinkUrls ) ) + .set( anchorLinkExtension.ANCHORLINKS_SET_ID, javacast( "boolean", arguments.options.anchorSetId ) ) + .set( anchorLinkExtension.ANCHORLINKS_SET_NAME, javacast( "boolean", arguments.options.achorSetName ) ) .set( anchorLinkExtension.ANCHORLINKS_WRAP_TEXT, - javacast( - "boolean", - arguments.options.anchorWrapText - ) + javacast( "boolean", arguments.options.anchorWrapText ) ) + .set( anchorLinkExtension.ANCHORLINKS_ANCHOR_CLASS, arguments.options.anchorClass ) + .set( anchorLinkExtension.ANCHORLINKS_TEXT_PREFIX, arguments.options.anchorPrefix ) + .set( anchorLinkExtension.ANCHORLINKS_TEXT_SUFFIX, arguments.options.anchorSuffix ) .set( - anchorLinkExtension.ANCHORLINKS_ANCHOR_CLASS, - arguments.options.anchorClass + variables.HtmlRenderer.CODE_STYLE_HTML_OPEN, + javacast( "string", arguments.options.codeStyleHTMLOpen ) ) .set( - anchorLinkExtension.ANCHORLINKS_TEXT_PREFIX, - arguments.options.anchorPrefix + variables.HtmlRenderer.CODE_STYLE_HTML_CLOSE, + javacast( "string", arguments.options.codeStyleHTMLClose ) ) .set( - anchorLinkExtension.ANCHORLINKS_TEXT_SUFFIX, - arguments.options.anchorSuffix + variables.HtmlRenderer.FENCED_CODE_LANGUAGE_CLASS_PREFIX, + javacast( "string", arguments.options.fencedCodeLanguageClassPrefix ) ) // Add Table Options .set( staticTableExtension.COLUMN_SPANS, - javacast( - "boolean", - arguments.options.tableOptions.columnSpans - ) + javacast( "boolean", arguments.options.tableOptions.columnSpans ) ) .set( staticTableExtension.APPEND_MISSING_COLUMNS, - javacast( - "boolean", - arguments.options.tableOptions.appendMissingColumns - ) + javacast( "boolean", arguments.options.tableOptions.appendMissingColumns ) ) .set( staticTableExtension.DISCARD_EXTRA_COLUMNS, - javacast( - "boolean", - arguments.options.tableOptions.discardExtraColumns - ) - ) - .set( - staticTableExtension.CLASS_NAME, - arguments.options.tableOptions.className + javacast( "boolean", arguments.options.tableOptions.discardExtraColumns ) ) + .set( staticTableExtension.CLASS_NAME, arguments.options.tableOptions.className ) .set( staticTableExtension.HEADER_SEPARATOR_COLUMN_MATCH, - javacast( - "boolean", - arguments.options.tableOptions.headerSeparationColumnMatch - ) + javacast( "boolean", arguments.options.tableOptions.headerSeparationColumnMatch ) ) // Load extensions - .set( - variables.StaticParser.EXTENSIONS, - extensionsToLoad - ); + .set( variables.StaticParser.EXTENSIONS, extensionsToLoad ); } } diff --git a/readme.md b/readme.md index 774bd02..6f07d53 100644 --- a/readme.md +++ b/readme.md @@ -17,7 +17,7 @@ Apache License, Version 2.0. ## System Requirements - Lucee 5+ -- ColdFusion 2016+ +- ColdFusion 2018+ ## Instructions @@ -29,7 +29,7 @@ Just use the CommandBox to install or drop into your **modules** folder: The module registers the following mapping in WireBox: `Processor@cbmarkdown`. Which is the class you will use to process markdown into HTML. There is one simple function to call on the processor: -* `toHTML( required txt )` - Convert markdown text to HTML. +- `toHTML( required txt )` - Convert markdown text to HTML. ### HTML to Markdown @@ -39,7 +39,7 @@ You can also use our `toMarkdown()` function to convert any HTML to markdown equ A subset of the flexmark options are supported. These can be configured in your module settings in your `config/Coldbox.cfc` via the `modulesettings` struct. -``` +```js moduleSettings = { cbmarkdown = { // Looks for www or emails and converts them to links @@ -60,6 +60,12 @@ moduleSettings = { anchorSuffix : "", // Enable youtube embedded link transformer enableYouTubeTransformer : false, + // override HTML to use for wrapping style. + codeStyleHTMLOpen : '', + // override HTML to use for wrapping style. + codeStyleHTMLClose : '', + // add a class prefix to the "fenced" code blocks, i.e. ```js. Useful for supporting various syntax highlighters. + fencedCodeLanguageClassPrefix : "brush", // Table options tableOptions : { // Treat consecutive pipes at the end of a column as defining spanning column. @@ -90,7 +96,7 @@ Because of His grace, this project exists. If you don't like this, then don't re 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 +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 ### THE DAILY BREAD diff --git a/test-harness/server-adobe@2016.json b/server-adobe@2016.json similarity index 59% rename from test-harness/server-adobe@2016.json rename to server-adobe@2016.json index d5c4b24..7480225 100644 --- a/test-harness/server-adobe@2016.json +++ b/server-adobe@2016.json @@ -10,7 +10,14 @@ }, "rewrites":{ "enable":"true" + }, + "webroot":"test-harness", + "aliases":{ + "/moduleroot/cbmarkdown":"../" } }, - "openBrowser":"false" -} \ No newline at end of file + "openBrowser":"false", + "cfconfig":{ + "file":".cfconfig.json" + } +} diff --git a/test-harness/server-adobe@2018.json b/server-adobe@2018.json similarity index 59% rename from test-harness/server-adobe@2018.json rename to server-adobe@2018.json index cf18af6..0eacac9 100644 --- a/test-harness/server-adobe@2018.json +++ b/server-adobe@2018.json @@ -10,7 +10,14 @@ }, "rewrites":{ "enable":"true" + }, + "webroot":"test-harness", + "aliases":{ + "/moduleroot/cbmarkdown":"../" } }, - "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..7808d80 --- /dev/null +++ b/server-adobe@2021.json @@ -0,0 +1,23 @@ +{ + "name":"cbfs-adobe@2021", + "app":{ + "serverHomeDirectory":".engine/adobe2021", + "cfengine":"adobe@2021" + }, + "web":{ + "http":{ + "port":"60299" + }, + "rewrites":{ + "enable":"true" + }, + "webroot":"test-harness", + "aliases":{ + "/moduleroot/cbmarkdown":"../" + } + }, + "openBrowser":"false", + "cfconfig":{ + "file":".cfconfig.json" + } +} diff --git a/test-harness/server-lucee@5.json b/server-lucee@5.json similarity index 59% rename from test-harness/server-lucee@5.json rename to server-lucee@5.json index 6c2253e..bc06a61 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/cbmarkdown":"../" } }, - "openBrowser":"false" -} \ No newline at end of file + "openBrowser":"false", + "cfconfig":{ + "file":".cfconfig.json" + } +} diff --git a/test-harness/Application.cfc b/test-harness/Application.cfc index 686213c..d8e5e56 100644 --- a/test-harness/Application.cfc +++ b/test-harness/Application.cfc @@ -4,7 +4,7 @@ Copyright 2005-2007 ColdBox Framework by Luis Majano and Ortus Solutions, Corp www.ortussolutions.com ******************************************************************************** */ -component{ +component { // UPDATE THE NAME OF THE MODULE IN TESTING BELOW request.MODULE_NAME = "cbmarkdown"; @@ -12,51 +12,63 @@ component{ // Application properties this.name = hash( getCurrentTemplatePath() ); this.sessionManagement = true; - this.sessionTimeout = createTimeSpan(0,0,15,0); - this.setClientCookies = true; + this.sessionTimeout = createTimespan( 0, 0, 15, 0 ); + this.setClientCookies = true; - /************************************** + /************************************** LUCEE Specific Settings **************************************/ // buffer the output of a tag/function body to output in case of a exception - this.bufferOutput = true; + this.bufferOutput = true; // Activate Gzip Compression - this.compression = false; + this.compression = false; // Turn on/off white space managemetn - this.whiteSpaceManagement = "smart"; + this.whiteSpaceManagement = "smart"; // Turn on/off remote cfc content whitespace this.suppressRemoteComponentContent = false; // COLDBOX STATIC PROPERTY, DO NOT CHANGE UNLESS THIS IS NOT THE ROOT OF YOUR COLDBOX APP - COLDBOX_APP_ROOT_PATH = getDirectoryFromPath( getCurrentTemplatePath() ); + COLDBOX_APP_ROOT_PATH = getDirectoryFromPath( getCurrentTemplatePath() ); // The web server mapping to this application. Used for remote purposes or static purposes - COLDBOX_APP_MAPPING = ""; + COLDBOX_APP_MAPPING = ""; // COLDBOX PROPERTIES - COLDBOX_CONFIG_FILE = ""; + COLDBOX_CONFIG_FILE = ""; // COLDBOX APPLICATION KEY OVERRIDE - COLDBOX_APP_KEY = ""; + COLDBOX_APP_KEY = ""; - // Mappings + // Mappings this.mappings[ "/root" ] = COLDBOX_APP_ROOT_PATH; // Map back to its root - moduleRootPath = REReplaceNoCase( this.mappings[ "/root" ], "#request.MODULE_NAME#(\\|/)test-harness(\\|/)", "" ); - modulePath = REReplaceNoCase( this.mappings[ "/root" ], "test-harness(\\|/)", "" ); + moduleRootPath = reReplaceNoCase( + this.mappings[ "/root" ], + "#request.MODULE_NAME#(\\|/)test-harness(\\|/)", + "" + ); + modulePath = reReplaceNoCase( + this.mappings[ "/root" ], + "test-harness(\\|/)", + "" + ); // Module Root + Path Mappings - this.mappings[ "/moduleroot" ] = moduleRootPath; + this.mappings[ "/moduleroot" ] = moduleRootPath; this.mappings[ "/#request.MODULE_NAME#" ] = modulePath; // application start public boolean function onApplicationStart(){ - application.cbBootstrap = new coldbox.system.Bootstrap( COLDBOX_CONFIG_FILE, COLDBOX_APP_ROOT_PATH, COLDBOX_APP_KEY, COLDBOX_APP_MAPPING ); + application.cbBootstrap = new coldbox.system.Bootstrap( + COLDBOX_CONFIG_FILE, + COLDBOX_APP_ROOT_PATH, + COLDBOX_APP_KEY, + COLDBOX_APP_MAPPING + ); application.cbBootstrap.loadColdbox(); return true; } // request start - public boolean function onRequestStart(String targetPage){ - + public boolean function onRequestStart( String targetPage ){ // Process ColdBox Request application.cbBootstrap.onRequestStart( arguments.targetPage ); @@ -68,11 +80,11 @@ component{ } public void function onSessionEnd( struct sessionScope, struct appScope ){ - arguments.appScope.cbBootStrap.onSessionEnd( argumentCollection=arguments ); + arguments.appScope.cbBootStrap.onSessionEnd( argumentCollection = arguments ); } public boolean function onMissingTemplate( template ){ - return application.cbBootstrap.onMissingTemplate( argumentCollection=arguments ); + return application.cbBootstrap.onMissingTemplate( argumentCollection = arguments ); } -} \ No newline at end of file +} diff --git a/test-harness/box.json b/test-harness/box.json index 6d08acf..0183324 100644 --- a/test-harness/box.json +++ b/test-harness/box.json @@ -5,12 +5,12 @@ "private":true, "description":"", "dependencies":{ - "coldbox":"^5.0.0", + "coldbox":"^6", "cbjavaloader":"^2.0.0+44", "cbemoji":"^1.1.0+16" }, "devDependencies":{ - "testbox":"^4.0.0" + "testbox":"*" }, "installPaths":{ "coldbox":"coldbox/", @@ -21,4 +21,4 @@ "testbox":{ "runner":"http://localhost:60299/tests/runner.cfm" } -} \ No newline at end of file +} diff --git a/test-harness/config/Application.cfc b/test-harness/config/Application.cfc index 23c5ad0..66424cb 100644 --- a/test-harness/config/Application.cfc +++ b/test-harness/config/Application.cfc @@ -1,7 +1,9 @@ -/** -* This is a protection Application cfm for the config file. You do not -* need to modify this file -*/ -component{ +/** + * This is a protection Application cfm for the config file. You do not + * need to modify this file + */ +component { + abort; -} \ No newline at end of file + +} diff --git a/test-harness/config/Coldbox.cfc b/test-harness/config/Coldbox.cfc index 0642181..39df582 100644 --- a/test-harness/config/Coldbox.cfc +++ b/test-harness/config/Coldbox.cfc @@ -1,86 +1,76 @@ -component{ +component { // Configure ColdBox Application function configure(){ - // coldbox directives coldbox = { - //Application Setup - appName = "Module Tester", - - //Development Settings - reinitPassword = "", - handlersIndexAutoReload = true, - modulesExternalLocation = [], - - //Implicit Events - defaultEvent = "", - requestStartHandler = "", - requestEndHandler = "", - applicationStartHandler = "", - applicationEndHandler = "", - sessionStartHandler = "", - sessionEndHandler = "", - missingTemplateHandler = "", - - //Error/Exception Handling - exceptionHandler = "", - onInvalidEvent = "", - customErrorTemplate = "/coldbox/system/includes/BugReport.cfm", + // Application Setup + appName : "Module Tester", + // Development Settings + reinitPassword : "", + handlersIndexAutoReload : true, + modulesExternalLocation : [], + // Implicit Events + defaultEvent : "", + requestStartHandler : "", + requestEndHandler : "", + applicationStartHandler : "", + applicationEndHandler : "", + sessionStartHandler : "", + sessionEndHandler : "", + missingTemplateHandler : "", + // Error/Exception Handling + exceptionHandler : "", + onInvalidEvent : "", + customErrorTemplate : "/coldbox/system/exceptions/Whoops.cfm", + // Application Aspects + handlerCaching : false, + eventCaching : false + }; - //Application Aspects - handlerCaching = false, - eventCaching = false + moduleSettings = { }; // environment settings, create a detectEnvironment() method to detect it yourself. // create a function with the name of the environment so it can be executed if that environment is detected // the value of the environment is a list of regex patterns to match the cgi.http_host. - environments = { - development = "localhost,127\.0\.0\.1" - }; + environments = { development : "localhost,127\.0\.0\.1" }; // Module Directives modules = { // An array of modules names to load, empty means all of them - include = [], + include : [], // An array of modules names to NOT load, empty means none - exclude = [] + exclude : [] }; - //Register interceptors as an array, we need order - interceptors = [ - //SES - { class="coldbox.system.interceptors.SES" } - ]; + // Register interceptors as an array, we need order + interceptors = []; - //LogBox DSL + // LogBox DSL logBox = { // Define Appenders - appenders = { - files={class="coldbox.system.logging.appenders.RollingFileAppender", - properties = { - filename = "tester", filePath="/#appMapping#/logs" - } + appenders : { + myConsole : { class : "ConsoleAppender" }, + files : { + class : "RollingFileAppender", + properties : { filename : "tester", filePath : "/#appMapping#/logs" } } }, // Root Logger - root = { levelmax="DEBUG", appenders="*" }, + root : { levelmax : "DEBUG", appenders : "*" }, // Implicit Level Categories - info = [ "coldbox.system" ] + info : [ "coldbox.system" ] }; - } /** * Load the Module you are testing */ - function afterAspectsLoad( event, interceptData, rc, prc ){ - controller.getModuleService() - .registerAndActivateModule( - moduleName = request.MODULE_NAME, - invocationPath = "moduleroot" - ); + function cbLoadInterceptorHelpers( event, interceptData, rc, prc ){ + controller + .getModuleService() + .registerAndActivateModule( moduleName = request.MODULE_NAME, invocationPath = "moduleroot" ); } -} \ No newline at end of file +} diff --git a/test-harness/config/WireBox.cfc b/test-harness/config/WireBox.cfc index 3aafc01..0a51718 100644 --- a/test-harness/config/WireBox.cfc +++ b/test-harness/config/WireBox.cfc @@ -1,46 +1,39 @@ -component extends="coldbox.system.ioc.config.Binder"{ - +component extends="coldbox.system.ioc.config.Binder" { + /** - * Configure WireBox, that's it! - */ + * 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" + scopeRegistration : { + enabled : true, + scope : "application", // server, cluster, session, application + key : "wireBox" }, - // DSL Namespace registrations - customDSL = { - // namespace = "mapping name" + customDSL : { + // namespace = "mapping name" }, - // Custom Storage Scopes - customScopes = { - // annotationName = "mapping name" + customScopes : { + // annotationName = "mapping name" }, - // Package scan locations - scanLocations = [], - + scanLocations : [], // Stop Recursions - stopRecursions = [], - + stopRecursions : [], // Parent Injector to assign to the configured injector, this must be an object reference - parentInjector = "", - + parentInjector : "", // Register all event listeners here, they are created in the specified order - listeners = [ - // { class="", name="", properties={} } - ] + listeners : [ + // { class="", name="", properties={} } + ] }; - + // Map Bindings below - } + } -} \ No newline at end of file +} diff --git a/test-harness/handlers/Main.cfc b/test-harness/handlers/Main.cfc index 588875b..9794de0 100644 --- a/test-harness/handlers/Main.cfc +++ b/test-harness/handlers/Main.cfc @@ -1,14 +1,14 @@ /** -* Process Markdown -*/ -component{ + * Process Markdown + */ +component { property name="processor" inject="processor@cbmarkdown"; // Index - any function index( event,rc, prc ){ + any function index( event, rc, prc ){ prc.html = processor.toHTML( renderView( "main/markdown.md" ) ); event.setView( "main/index" ); } -} \ No newline at end of file +} diff --git a/test-harness/layouts/Main.cfm b/test-harness/layouts/Main.cfm index f8894ef..d0dbf74 100644 --- a/test-harness/layouts/Main.cfm +++ b/test-harness/layouts/Main.cfm @@ -3,4 +3,9 @@
#renderView()#
+ + + + + \ No newline at end of file diff --git a/test-harness/tests/Application.cfc b/test-harness/tests/Application.cfc index c7ea3bb..e036430 100644 --- a/test-harness/tests/Application.cfc +++ b/test-harness/tests/Application.cfc @@ -7,26 +7,30 @@ www.ortussolutions.com component { // APPLICATION CFC PROPERTIES - this.name = "ColdBoxTestingSuite" & hash( getCurrentTemplatePath() ); - this.sessionManagement = true; - this.clientManagement = true; - this.sessionTimeout = createTimespan( 0, 0, 15, 0 ); + this.name = "ColdBoxTestingSuite" & hash( getCurrentTemplatePath() ); + this.sessionManagement = true; + this.clientManagement = true; + this.sessionTimeout = createTimespan( 0, 0, 15, 0 ); this.applicationTimeout = createTimespan( 0, 0, 15, 0 ); - this.setClientCookies = true; + this.setClientCookies = true; // Create testing mapping this.mappings[ "/tests" ] = getDirectoryFromPath( getCurrentTemplatePath() ); // The application root - rootPath = reReplaceNoCase( this.mappings[ "/tests" ], "tests(\\|/)", "" ); + rootPath = reReplaceNoCase( this.mappings[ "/tests" ], "tests(\\|/)", "" ); this.mappings[ "/root" ] = rootPath; // UPDATE THE NAME OF THE MODULE IN TESTING BELOW request.MODULE_NAME = "cbmarkdown"; // The module root path - moduleRootPath = reReplaceNoCase( this.mappings[ "/root" ], "#request.module_name#(\\|/)test-harness(\\|/)", "" ); - this.mappings[ "/moduleroot" ] = moduleRootPath; + moduleRootPath = reReplaceNoCase( + this.mappings[ "/root" ], + "#request.module_name#(\\|/)test-harness(\\|/)", + "" + ); + this.mappings[ "/moduleroot" ] = moduleRootPath; this.mappings[ "/#request.MODULE_NAME#" ] = moduleRootPath & "#request.MODULE_NAME#"; }