From 79fb29869bb341dff53fac6aace74819e5502ed3 Mon Sep 17 00:00:00 2001 From: Grant Copley Date: Mon, 15 May 2023 13:21:35 -0500 Subject: [PATCH] Change to use module-template layout --- .cfconfig.json | 24 +- .cfformat.json | 39 +- .cflintrc | 1 - .env.example => .env.template | 0 .gitattributes | 20 +- .github/CODE_OF_CONDUCT.MD | 3 + .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/SECURITY.md | 3 + .github/SUPPORT.md | 3 + .github/workflows/pr.yml | 29 ++ .github/workflows/release.yml | 175 ++++++++ .github/workflows/snapshot.yml | 43 ++ .github/workflows/tests.yml | 128 ++++++ .gitignore | 23 +- .vscode/settings.json | 14 + .vscode/tasks.json | 33 ++ CONTRIBUTING.md | 108 +++++ ModuleConfig.cfc | 49 ++- README.md | 309 ++++---------- box.json | 86 ++-- build/Build.cfc | 24 -- build/SetupTemplate.cfc | 101 +---- build/release.boxr | 11 - changelog.md | 12 +- server-adobe@2018.json | 12 +- server-adobe@2021.json | 29 ++ server-adobe@2023.json | 29 ++ server-lucee@5.json | 12 +- test-harness/.cfconfig.json | 8 - test-harness/Application.cfc | 27 +- test-harness/box.json | 17 +- test-harness/config/Coldbox.cfc | 28 +- test-harness/config/Router.cfc | 14 +- test-harness/config/WireBox.cfc | 20 +- test-harness/handlers/Main.cfc | 14 +- test-harness/layouts/Main.cfm | 121 ++---- test-harness/server-adobe@2018.json | 19 - test-harness/server-adobe@2021.json | 19 - test-harness/server-lucee@5.json | 19 - test-harness/tests/Application.cfc | 95 +++-- test-harness/tests/index.cfm | 12 +- test-harness/tests/resources/coolblog.sql | 473 ++++++++++++++++++++++ test-harness/tests/runner.cfm | 15 +- test-harness/tests/specs/ModuleSpec.cfc | 24 ++ test-harness/views/main/getModels.cfm | 5 + test-harness/views/main/index.cfm | 7 + 49 files changed, 1598 insertions(+), 740 deletions(-) rename .env.example => .env.template (100%) mode change 100644 => 100755 .gitattributes create mode 100644 .github/CODE_OF_CONDUCT.MD 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/SECURITY.md create mode 100644 .github/SUPPORT.md create mode 100644 .github/workflows/pr.yml create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/snapshot.yml create mode 100644 .github/workflows/tests.yml create mode 100644 .vscode/settings.json create mode 100644 .vscode/tasks.json create mode 100644 CONTRIBUTING.md create mode 100644 server-adobe@2021.json create mode 100644 server-adobe@2023.json delete mode 100644 test-harness/.cfconfig.json mode change 100644 => 100755 test-harness/config/Router.cfc delete mode 100644 test-harness/server-adobe@2018.json delete mode 100644 test-harness/server-adobe@2021.json delete mode 100644 test-harness/server-lucee@5.json create mode 100644 test-harness/tests/resources/coolblog.sql create mode 100644 test-harness/tests/specs/ModuleSpec.cfc create mode 100644 test-harness/views/main/getModels.cfm create mode 100644 test-harness/views/main/index.cfm diff --git a/.cfconfig.json b/.cfconfig.json index 1af3093..f9b3828 100644 --- a/.cfconfig.json +++ b/.cfconfig.json @@ -1,8 +1,26 @@ { - "debuggingEnabled":false, + "adminPassword" : "coldbox", + "debuggingEnabled":true, "debuggingReportExecutionTimes":false, "disableInternalCFJavaComponents":false, "inspectTemplate":"always", "requestTimeout":"0,0,0,90", - "robustExceptionEnabled":true -} \ No newline at end of file + "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&allowPublicKeyRetrieval=true", + "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" + } + } +} diff --git a/.cfformat.json b/.cfformat.json index bbf8d1f..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": false, - "alignment.consecutive.properties": false, - "alignment.consecutive.params": 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": 5, + "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": 5, - "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": 5, + "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, - "metadata.multiline.element_count": 5, - "metadata.multiline.min_length": 40, - "method_call.chain.multiline": 3, - "newline": "\n", - "property.multiline.element_count": 5, - "property.multiline.min_length": 40, + "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", @@ -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/.cflintrc b/.cflintrc index b49687b..a3e8368 100644 --- a/.cflintrc +++ b/.cflintrc @@ -1,4 +1,3 @@ - { "rule": [], "includes": [ diff --git a/.env.example b/.env.template similarity index 100% rename from .env.example rename to .env.template 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/CODE_OF_CONDUCT.MD b/.github/CODE_OF_CONDUCT.MD new file mode 100644 index 0000000..12507ab --- /dev/null +++ b/.github/CODE_OF_CONDUCT.MD @@ -0,0 +1,3 @@ +# Code of Conduct + +Please see it in our [Contributing Guidelines](../CONTRIBUTING.md#code-of-conduct). 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/SECURITY.md b/.github/SECURITY.md new file mode 100644 index 0000000..f057099 --- /dev/null +++ b/.github/SECURITY.md @@ -0,0 +1,3 @@ +# Security Policy + +Please see it in our [Contributing Guidelines](../CONTRIBUTING.md#security-vulnerabilities). diff --git a/.github/SUPPORT.md b/.github/SUPPORT.md new file mode 100644 index 0000000..3bb8adb --- /dev/null +++ b/.github/SUPPORT.md @@ -0,0 +1,3 @@ +# Support & Help + +Please see it in our [Contributing Guidelines](../CONTRIBUTING.md#support-questions). diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000..d78c2d7 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,29 @@ +name: Pull Requests + +on: + push: + branches-ignore: + - "main" + - "master" + - "development" + - "releases/v*" + pull_request: + branches: + - "releases/v*" + - development + +jobs: + tests: + uses: ./.github/workflows/tests.yml + secrets: inherit + + formatCheck: + name: Checks Source Code Formatting + runs-on: ubuntu-20.04 + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + + - uses: Ortus-Solutions/commandbox-action@v1.0.2 + with: + cmd: run-script format:check diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..207515a --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,175 @@ +name: Build a Release + +on: + # If you push to master|main this will trigger a stable release + push: + branches: + - master + - main + + # Reusable workflow : Usually called by a `snapshot` workflow + workflow_call: + inputs: + snapshot: + description: 'Is this a snapshot build?' + required: false + default: false + type: boolean + +env: + MODULE_ID: cbopenai + SNAPSHOT: ${{ inputs.snapshot || false }} + +jobs: + ########################################################################################## + # Build & Publish + ########################################################################################## + build: + name: Build & Publish + runs-on: ubuntu-20.04 + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + + - 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: Update changelog [unreleased] with latest version + uses: thomaseizinger/keep-a-changelog-new-release@1.3.0 + if: env.SNAPSHOT == 'false' + with: + changelogPath: ./changelog.md + tag: v${{ env.VERSION }} + + - name: Build ${{ env.MODULE_ID }} + run: | + npm install -g markdownlint-cli + markdownlint changelog.md --fix + 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: Commit Changelog To Master + uses: EndBug/add-and-commit@v9.1.1 + if: env.SNAPSHOT == 'false' + with: + author_name: Github Actions + author_email: info@ortussolutions.com + message: 'Finalized changelog for v${{ env.VERSION }}' + add: changelog.md + + - name: Tag Version + uses: rickstaa/action-create-tag@v1.6.1 + if: env.SNAPSHOT == 'false' + with: + tag: "v${{ env.VERSION }}" + force_push_tag: true + message: "Latest Release v${{ env.VERSION }}" + + - name: Upload Build Artifacts + if: success() + uses: actions/upload-artifact@v3 + with: + name: ${{ env.MODULE_ID }} + path: | + .artifacts/**/* + changelog.md + + - 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 --force + + - name: Create Github Release + uses: taiki-e/create-gh-release-action@v1.6.2 + continue-on-error: true + if: env.SNAPSHOT == 'false' + with: + title: ${{ env.VERSION }} + changelog: changelog.md + token: ${{ secrets.GITHUB_TOKEN }} + ref: refs/tags/v${{ env.VERSION }} + + ########################################################################################## + # Prep Next Release + ########################################################################################## + prep_next_release: + name: Prep Next Release + if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' + runs-on: ubuntu-20.04 + needs: [ build ] + steps: + # Checkout development + - name: Checkout Repository + uses: actions/checkout@v3 + with: + ref: development + + - name: Setup CommandBox + uses: Ortus-Solutions/setup-commandbox@v2.0.1 + with: + forgeboxAPIKey: ${{ secrets.FORGEBOX_TOKEN }} + + - name: Download build artifacts + uses: actions/download-artifact@v2 + with: + name: ${{ env.MODULE_ID }} + path: .tmp + + # Copy the changelog to the development branch + - name: Copy Changelog + run: | + cp .tmp/changelog.md changelog.md + + # Bump to next version + - name: Bump Version + run: | + box bump --minor --!TagVersion + + # Commit it back to development + - name: Commit Version Bump + uses: EndBug/add-and-commit@v9.1.1 + with: + author_name: Github Actions + author_email: info@ortussolutions.com + message: 'Version bump' + add: | + box.json + changelog.md diff --git a/.github/workflows/snapshot.yml b/.github/workflows/snapshot.yml new file mode 100644 index 0000000..45d7dd1 --- /dev/null +++ b/.github/workflows/snapshot.yml @@ -0,0 +1,43 @@ +name: Build Snapshot + +on: + push: + branches: + - 'development' + +jobs: + ########################################################################################## + # Module Tests + ########################################################################################## + tests: + secrets: inherit + uses: ./.github/workflows/tests.yml + + ########################################################################################## + # Format Source Code + ########################################################################################## + format: + name: Code Auto-Formatting + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v3 + + - name: Auto-format + 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 + + ########################################################################################## + # Release it + ########################################################################################## + release: + uses: ./.github/workflows/release.yml + needs: [ tests, format ] + secrets: inherit + with: + snapshot: true diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..fa9ddee --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,128 @@ +name: Test Suites + +# We are a reusable Workflow only +on: + workflow_call: + secrets: + SLACK_WEBHOOK_URL: + required: false + +jobs: + tests: + name: Tests + runs-on: ubuntu-20.04 + env: + DB_USER: root + DB_PASSWORD: root + continue-on-error: ${{ matrix.experimental }} + strategy: + fail-fast: false + matrix: + cfengine: [ "lucee@5", "adobe@2018", "adobe@2021" ] + coldboxVersion: [ "^6.0.0" ] + experimental: [ false ] + include: + - cfengine: "adobe@2023" + coldboxVersion: "^6.0.0" + experimental: true + - coldboxVersion: "be" + cfengine: "lucee@5" + experimental: true + - coldboxVersion: "be" + cfengine: "adobe@2018" + experimental: true + - coldboxVersion: "be" + cfengine: "adobe@2021" + experimental: true + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + + # - name: Setup Database and Fixtures + # run: | + # sudo systemctl start mysql.service + # mysql -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }} -e 'CREATE DATABASE mementifier;' + # mysql -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }} < test-harness/tests/resources/coolblog.sql + + - name: Setup Java + uses: actions/setup-java@v3 + 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 + # 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 with ColdBox ${{ matrix.coldboxVersion }} + run: | + box install + cd test-harness + box package set dependencies.coldbox=${{ matrix.coldboxVersion }} + 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 }} ColdBox ${{ matrix.coldboxVersion }} Test Results" + + - name: Upload Test Results to Artifacts + if: always() + uses: actions/upload-artifact@v3 + with: + name: test-results-${{ matrix.cfengine }}-${{ matrix.coldboxVersion }} + 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 + with: + name: Failure Debugging Info - ${{ matrix.cfengine }} - ${{ matrix.coldboxVersion }} + 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 }} with ColdBox ${{ matrix.coldboxVersion }} failed + SLACK_USERNAME: CI + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} diff --git a/.gitignore b/.gitignore index ac089cb..308bbea 100644 --- a/.gitignore +++ b/.gitignore @@ -1,27 +1,20 @@ -.vscode - +# Artifacts and temp folders .artifacts/** .tmp/** -docbox/** -dist/** - -modules/** - +# Engine + Secrets +.env .engine/** -test-harness/.engine/** + +# Dependencies test-harness/coldbox/** test-harness/docbox/** test-harness/testbox/** -test-harness/tests/results/** test-harness/logs/** test-harness/modules/** +# modules +modules/** + # log files logs/** - -# node modules -node_modules/** - -livewire/** -.env 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..6092c9d --- /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} --!recurse", + "group": { + "kind": "build", + "isDefault": true + }, + "presentation": { + "reveal": "always", + "panel": "new" + }, + "problemMatcher": [] + } + ] +} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..bb19464 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,108 @@ +# Contributing Guide + +Hola amigo! I'm really excited that you are interested in contributing to cbopenai. Before submitting your contribution, please make sure to take a moment and read through the following guidelines: + +- [Code Of Conduct](#code-of-conduct) +- [Bug Reporting](#bug-reporting) +- [Support Questions](#support-questions) +- [Pull Request Guidelines](#pull-request-guidelines) +- [Security Vulnerabilities](#security-vulnerabilities) +- [Development Setup](#development-setup) +- [Language Compatibility](#language-compatibility) +- [Coding Styles \& Formatting](#coding-styles--formatting) +- [CFC Docs With DocBox](#cfc-docs-with-docbox) +- [Financial Contributions](#financial-contributions) +- [Contributors](#contributors) + +## Code Of Conduct + +This project is open source, and as such, the maintainers give their free time to build and maintain the source code held within. They make the code freely available in the hope that it will be of use to other developers and/or businesses. Please be considerate towards maintainers when raising issues or presenting pull requests. **We all follow the Golden Rule: Do to others as you want them to do to you.** + +- As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities. +- Participants will be tolerant of opposing views. +- Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct. +- Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned with this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team. +- When interpreting the words and actions of others, participants should always assume good intentions. Emotions cannot be derived from textual representations. +- Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers. + + +## Bug Reporting + +Please make sure also that if you submit a pull request, you link it to the appropriate issue(s). + +If you file a bug report, your issue should contain a title, a clear description of the issue, a way to replicate the issue, and any support files that we might need to replicate your issue. The goal of a bug report is to make it easy for yourself - and others - to replicate the bug and develop a fix for it. All issues that do not contain a way to replicate will not be addressed. + +## Support Questions + +If you have any questions on usage, professional support or just ideas to bounce off the maintainers, please do not create an issue. Leverage our support channels first. + +- Ortus Community Discourse: https://community.ortussolutions.com +- Box Slack Team: http://boxteam.ortussolutions.com/ +- Professional Support: https://www.ortussolutions.com/services/support + +## Pull Request Guidelines + +- The `(master|main)` branch is just a snapshot of the latest stable release. All development should be done in dedicated branches. Do not submit PRs against the master branch. They will be closed. +- All pull requests should be sent to the `development` branch or the appropriate LTS branch (`releases/v{version}`). +- It's OK to have multiple small commits as you work on the PR - GitHub will automatically squash it before merging. +- Make sure all local tests pass before submitting the merge. +- Please make sure all your pull requests have companion tests. +- Please link the Jira issue in your PR title when sending the final PR + +## Security Vulnerabilities + +If you discover a security vulnerability, please send an email to the Ortus security team at [security@ortussolutions.com](mailto:security@ortussolutions.com?subject=security) and make sure you report it to the `#security` channel in our Box Team Slack Channel. All security vulnerabilities will be promptly addressed. + +## Development Setup + +1. Fork and Star our project. +2. Make sure you have CommandBox installed: https://www.ortussolutions.com/products/commandbox#download +3. Start a CommandBox shell in the root of the project: `box` +4. Install the development dependencies: `run-script install:dependencies` +5. Hack away! Create tests under `/test-harness/specs` or wherever they are set in the project and run the tests! + +## Language Compatibility + +Please make sure your code runs on the following CFML Engines: + +- Lucee 5+ +- Adobe ColdFusion 2018+ + +## Coding Styles & Formatting + +We are big on coding styles and have included a `.cfformat.json` in the root of the project so that you can run the formatting tools and CommandBox scripts: + +```bash +# Format everything +box run-script format + +# Start a watcher, type away, save and auto-format for you +box run-script format:watch +``` + +We recommend that anytime you hack on the core you start the formatter watcher (`box run-script format:watch`). This will monitor your changes and auto-format your code for you. + +You can also see the Ortus Coding Standards you must follow here: https://github.com/Ortus-Solutions/coding-standards. + +## CFC Docs With DocBox + +All CFCs are self-documenting and we leverage [DocBox](https://docbox.ortusbooks.com/) to document the entire software. All functions must be properly documented using the DocBox syntax: https://docbox.ortusbooks.com/getting-started/annotating-your-code + + +## Financial Contributions + +You can support ColdBox and all of our Open Source initiatives at Ortus Solutions by becoming a patreon. You can also get lots of goodies and services depending on the level of contributions. + +- [Become a backer or sponsor on Patreon](https://www.patreon.com/ortussolutions) +- [One-time donations via PayPal](https://www.paypal.com/paypalme/ortussolutions) + +## Contributors + +Thank you to all the people who have already contributed to cbopenai! We :heart: :heart: :heart: love you! + + + + + + +Made with [contributors-img](https://contrib.rocks) diff --git a/ModuleConfig.cfc b/ModuleConfig.cfc index 61bd3f3..819946c 100644 --- a/ModuleConfig.cfc +++ b/ModuleConfig.cfc @@ -1,30 +1,47 @@ +/** + * Copyright Since 2005 ColdBox Framework by Luis Majano and Ortus Solutions, Corp + * www.ortussolutions.com + * --- + */ component { - this.name = "cbopenai"; - this.version = "1.0.0"; - this.author = ""; - this.webUrl = "https://github.com/coldbox-modules/cbopenai"; - this.dependencies = []; + // Module Properties + this.title = "cbopenai"; + this.author = "Ortus Solutions"; + this.webURL = "https://www.ortussolutions.com"; + this.description = "CBOPENAI is a ColdBox module that provides a simple API to access OpenAI's variety of AI services."; + this.version = "@build.version@+@build.number@"; - this.entryPoint = "cbopenai"; + // Model Namespace + this.modelNamespace = "cbopenai"; - this.layoutParentLookup = false; - this.viewParentLookup = false; - this.cfmapping = "cbopenai"; - this.modelNamespace = "cbopenai"; - this.applicationHelper = [ "helpers/helpers.cfm" ]; + // CF Mapping + this.cfmapping = "cbopenai"; + // Dependencies + this.dependencies = []; + + /** + * Configure Module + */ function configure(){ settings = { }; + } - interceptorSettings = { - customInterceptionPoints : [] - }; + /** + * Fired when the module is registered and activated. + */ + function onLoad(){ + + } + + /** + * Fired when the module is unregistered and unloaded + */ + function onUnload(){ - interceptors = [ - ]; } } diff --git a/README.md b/README.md index 5e8907e..152ac4e 100644 --- a/README.md +++ b/README.md @@ -1,272 +1,101 @@ -# CBOPENAI +

+ +
+ + + +

-[![cbopenai CI](https://github.com/coldbox-modules/cbopenai/actions/workflows/ci.yml/badge.svg?branch=development)](https://github.com/coldbox-modules/cbopenai/actions/workflows/ci.yml) +

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

-CBOPENAI is a module that provides a simple API to access OpenAI's variety of AI services. +---- -## Requirements +# Ortus ColdBox Module Template -- Adobe CF 2018+ or Lucee 5+ -- ColdBox 6+ - -## Installation - -Install [CommandBox](https://www.ortussolutions.com/products/commandbox), then from your terminal, run: +This template can be used to create Ortus based ColdBox Modules. To use, just click the `Use this Template` button in the github repository: https://github.com/coldbox-modules/module-template and run the setup task from where you cloned it. ```bash -# Install latest stable version -box install cbopenai -# Install bleeding edge -box install cbopenai@be -``` - -## Service Object -CBOPENAI comes with a service object you can use for all operations. -```javascript -// Using WireBox injection -property name="openAIService" inject="OpenAIService@cbopenai"; -// Using getInstance -var openAIService = getInstance( "OpenAIService@cbopenai" ); -``` - -## Usage - -**getModels** -List and describe the various models available in the API. You can refer to the Models documentation to understand what models are available and the differences between them. -```javascript -function getModels() - -var models = openAIService.getModels(); -``` - -**getModel** -Retrieves a model instance, providing basic information about the model such as the owner and permissioning. -```javascript -function getModel( required string model ) - -var model = openAIService.getModel( "text-davinci-003" ); -``` - -**createModeration** -Classifies if text violates OpenAI's Content Policy -```javascript -function createModeration( required string input ) - -var moderation = openAIService.createModeration( input="I'm going to murder that sandwhich later." ); -``` - -**createCompletion** -Given a prompt, the model will return one or more predicted completions, and can also return the probabilities of alternative tokens at each position. - -```javascript -function createCompletion( - required any prompt, - string model = "text-davinci-003", - string suffix, - numeric maxTokens, - numeric temperature, - numeric topP, - numeric n, - boolean stream, - numeric logprops, - boolean echo, - any stop, - numeric presencePenalty, - numeric frequencyPenalty, - numeric bestOf, - struct logitBias, - string user -) - -var completion = openAIService.createCompletion( prompt="What is 2+2?" ); +box task run taskFile=build/SetupTemplate ``` -**createChatCompletion** -Given a list of messages describing a conversation, the model will return a response. -```javascript -function createChatCompletion( - required array messages, - string model = "gpt-3.5-turbo", - numeric max_tokens, - numeric temperature, - numeric top_p, - numeric n, - boolean stream, - numeric logprops, - any stop, - numeric presence_penalty, - numeric frequency_penalty, - struct logit_bias, - string user -) +The `SetupTemplate` task will ask you for your module name, id and description and configure the template for you! Enjoy! -var completion = openAIService.createChatCompletion( - messages = [ - { - "role": "user", - "content": "Hello!" - } - ] -) -``` - -**createImage** -Creates an image given a prompt. -```javascript -function createImage( - required string prompt, - numeric n, - string size, - string response_format, - string user -) - -var images = openAIService.createImage( prompt="A cat with a funny hat.", n=2 ); // create 2 images -``` - -**createImageEdit** -Creates an edited or extended image given an original image and a prompt. -```javascript -function createImageEdit( - required string image, - string mask, - string prompt, - numeric n, - string size, - string response_format, - string user -) +## Directory Structure -var image = openAIService.createImageEdit( image=expandPath( "somefile.png" ) ); -``` +The root of the module is the root of the repository. Add all the necessary files your module will need. -**createImageVariation** -Creates a variation of a given image. -```javascript -function createImageVariation( - required string image, - numeric n, - string size, - string response_format, - string user -) +* `.github/workflows` - These are the github actions to test and build the module via CI +* `build` - This is the CommandBox task that builds the project. Only modify if needed. Most modules will never modify it. (Modify if needed) +* `test-harness` - This is a ColdBox testing application, where you will add your testing files, specs etc. +* `.cfformat.json` - A CFFormat using the Ortus Standards +* `.cflintrc` - A CFLint configuration file according to Ortus Standards +* `.editorconfig` - Smooth consistency between editors +* `.gitattributes` - Git attributes +* `.gitignore` - Basic ignores. Modify as needed. +* `.markdownlint.json` - A linting file for markdown docs +* `box.json` - The box.json for YOUR module. Modify as needed. +* `changelog.md` - A nice changelog tracking file +* `ModuleConfig.cfc` - Your module's configuration. Modify as needed. +* `readme.md` - Your module's readme. Modify as needed. +* `server-xx@x.json` - A set of json files to configure the major engines your modules supports. -var image = openAIService.createImageVariation( image=expandPath( "somefile.png" ) ); -``` - -**createEdit** -Given a prompt and an instruction, the model will return an edited version of the prompt. -```javascript -function createEdit( - string model = "text-davinci-edit-001", - string input, - string instruction, - numeric n, - numeric temperature, - numeric top_p -) - -var edit = openAIService.createEdit( - input="What day of the wek is it?", - instruction="Fix the spelling mistakes." -); -``` - -**createdEmbedding** -Get a vector representation of a given input that can be easily consumed by machine learning models and algorithms. -```javascript -function createEmbedding( - required any input, - model = "text-embedding-ada-002", - string user -) - -var embedding = openAIService.createEmbedding( input="The food was delicious and the waiter..." ); -``` - -**createAudioTranscription** -Transcribes audio into the input language. - -```javascript -function createAudioTranscription( - required string file, - required string model = "whisper-1", - string prompt, - string response_format, - numeric temperature, - string language -) - -var text = openAIService.createAudioTranscription( - file = expandPath( "/includes/audio/obi_wan_hello_there.mp3" ) -); -``` - -**createAudioTranslation** -Translates audio into into English. - -```javascript -function createAudioTranslation( - required string file, - required string model = "whisper-1", - string prompt, - string response_format, - numeric temperature -) +## Test Harness -var text = openAIService.createAudioTranslation( - file = expandPath( "/includes/audio/german.mp3" ) -); -``` +The test harness is created to bootstrap your working module into the application `afterAspectsLoad`. This is done in the `config/ColdBox.cfc`. It includes some key features: -## Examples +* `config` - Modify as needed +* `tests` - All your testing specs should go here. Please notice the commented out ORM fixtures. Enable them if your module requires ORM +* `.cfconfig.json` - A prepared cfconfig json file so your engine data is consistent. Modify as needed. +* `.env.sample` - An environment property file sample. Copy and create a `.env` if your app requires it. -Included in this repo is an app where you can experience and see code examples covering all the features of CBOPENAI. -Just run the following from the `test-harness` directory: +## API Docs -``` -box install && cd .. && box server start -``` +The build task will take care of building API Docs using DocBox for you but **ONLY** for the `models` folder in your module. If you want to document more then make sure you modify the `build/Build.cfc` task. -Then visit: +## Github Actions Automation -http://localhost:60299/ +The github actions will clone, test, package, deploy your module to ForgeBox and the Ortus S3 accounts for API Docs and Artifacts. So please make sure the following environment variables are set in your repository. ** Please note that most of them are already defined at the org level ** +* `FORGEBOX_TOKEN` - The Ortus ForgeBox API Token +* `AWS_ACCESS_KEY` - The travis user S3 account +* `AWS_ACCESS_SECRET` - The travis secret S3 -## Contributing +> Please contact the admins in the `#infrastructure` channel for these credentials if needed -We love PRs! Please create a ticket using the [ Issue Tracker](https://github.com/coldbox-modules/cbopenai/issues) before submitting a PR. +## Welcome to ColdBox -## Test Harness - -There is a test harness application included in this repo. - -To start the test harness: - -``` -cd test-harness -box install -box server start -``` +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: -This will start the test harness using a random port selected by CommandBox. For example, if the random port selected is 60299, you can run the test suite using http://127.0.0.1:60299/tests. +* [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 -## License +## Learning ColdBox -Apache License 2.0 +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. -## Credits -The CBOPENAI module for ColdBox is written and maintained by [Grant Copley](https://twitter.com/grantcopley) and [Ortus Solutions](https://www.ortussolutions.com/). +If you don't like reading so much, then you can try our video learning platform: [CFCasts (www.cfcasts.com)](https://www.cfcasts.com) -## Project Support +## Ortus Sponsors -If CBOPENAI makes you happy, please consider becoming an Ortus [Patreon supporter](https://www.patreon.com/ortussolutions). +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) -## Resources +### THE DAILY BREAD -- Docmentation: https://github.com/coldbox-modules/cbopenai -- API Docs: https://apidocs.ortussolutions.com/#/coldbox-modules/cbopenai/ -- GitHub Repository: https://github.com/coldbox-modules/cbopenai -- Issue Tracker: https://github.com/coldbox-modules/cbopenai/issues + > "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/box.json b/box.json index df42dbf..ad98254 100644 --- a/box.json +++ b/box.json @@ -1,48 +1,54 @@ { - "name":"cbopenai", - "version":"1.0.0-snapshot", - "location":"forgeboxStorage", - "author":"Ortus Solutions ", + "homepage" : "https://github.com/coldbox-modules/cbopenai", + "documentation" : "https://github.com/coldbox-modules/cbopenai", + "repository" : { "type" : "git", "url" : "https://github.com/coldbox-modules/cbopenai" }, + "bugs" : "https://github.com/coldbox-modules/cbopenai", + "shortDescription" : "Description goes here", + "slug" : "cbopenai", + "type" : "modules", + "keywords":"", + "license" : [ + { "type" : "Apache2", "url" : "http://www.apache.org/licenses/LICENSE-2.0.html" } + ], + "contributors" : [ + ], + "dependencies" :{ + }, + "devDependencies" :{ + "commandbox-cfformat":"*", + "commandbox-docbox":"*", + "commandbox-dotenv":"*", + "commandbox-cfconfig":"*" + }, + "ignore":[ "**/.*", - "test-harness" + "test-harness", + "/server*.json" ], - "scripts":{ - "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`", - "release":"recipe build/release.boxr", + "scripts":{ + "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 helpers,models,test-harness/tests/,ModuleConfig.cfc --overwrite", "format:watch":"cfformat watch helpers,models,test-harness/tests/,ModuleConfig.cfc ./.cfformat.json", - "format:check":"cfformat check helpers,models,test-harness/tests/,ModuleConfig.cfc" + "format:check":"cfformat check helpers,models,test-harness/tests/,ModuleConfig.cfc ./.cfformat.json", + "start:lucee" : "server start serverConfigFile=server-lucee@5.json", + "start:2018" : "server start serverConfigFile=server-adobe@2018.json", + "start:2021" : "server start serverConfigFile=server-adobe@2021.json", + "stop:lucee" : "server stop serverConfigFile=server-lucee@5.json", + "stop:2018" : "server stop serverConfigFile=server-adobe@2018.json", + "stop:2021" : "server stop serverConfigFile=server-adobe@2021.json", + "logs:lucee" : "server log serverConfigFile=server-lucee@5.json --follow", + "logs:2018" : "server log serverConfigFile=server-adobe@2018.json --follow", + "logs:2021" : "server log serverConfigFile=server-adobe@2021.json --follow" }, - "testbox":{ + "testbox":{ "runner":"http://localhost:60299/tests/runner.cfm" - }, - "installPaths":{ } -} \ No newline at end of file +} diff --git a/build/Build.cfc b/build/Build.cfc index 8e6eb76..ee9366e 100644 --- a/build/Build.cfc +++ b/build/Build.cfc @@ -76,9 +76,6 @@ component { // checksums buildChecksums(); - // Build latest changelog - latestChangelog(); - // Finalize Message print .line() @@ -227,27 +224,6 @@ component { ); } - /** - * 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 *********************************************/ /** diff --git a/build/SetupTemplate.cfc b/build/SetupTemplate.cfc index 8bede6b..09ec0d0 100644 --- a/build/SetupTemplate.cfc +++ b/build/SetupTemplate.cfc @@ -1,4 +1,3 @@ - /** * Setup the Module Template according to your needs */ @@ -9,7 +8,7 @@ component { */ function init(){ // Setup Pathing - variables.cwd = getCWD().reReplace( "\.$", "" ); + variables.cwd = getCWD().reReplace( "\.$", "" ); return this; } @@ -18,6 +17,12 @@ component { */ 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" ); @@ -34,7 +39,7 @@ component { command( "tokenReplace" ) .params( path = "/#variables.cwd#/**", - token = "@MODULE_NAME@", + token = "cbopenai", replacement = moduleName ) .run(); @@ -42,7 +47,7 @@ component { command( "tokenReplace" ) .params( path = "/#variables.cwd#/**", - token = "@MODULE_SLUG@", + token = "cbopenai", replacement = moduleSlug ) .run(); @@ -50,7 +55,7 @@ component { command( "tokenReplace" ) .params( path = "/#variables.cwd#/**", - token = "@MODULE_DESCRIPTION@", + token = "CBOPENAI is a ColdBox module that provides a simple API to access OpenAI's variety of AI services.", replacement = moduleDescription ) .run(); @@ -58,92 +63,8 @@ component { // Finalize Message print .line() - .boldMagentaLine( "Your module template is now ready for development! Go rock it!" ) - .toConsole(); - } - - /** - * 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." - ) + .boldMagentaLine( "Your module template is now ready for development! Just add the github origin, commit some code and Go rock it!" ) .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 - ); } } diff --git a/build/release.boxr b/build/release.boxr index e216f22..a63f2cc 100755 --- a/build/release.boxr +++ b/build/release.boxr @@ -7,19 +7,8 @@ # Merge development into it for release !git merge --no-ff development -# 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 -!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 47cfae8..46f833a 100644 --- a/changelog.md +++ b/changelog.md @@ -1,4 +1,14 @@ # Changelog -## [1.0.0] => 2023-MAY +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] + +## [1.0.0] => 2021-JAN-01 + +* First iteration of this module diff --git a/server-adobe@2018.json b/server-adobe@2018.json index 6bcd90d..9f5dfb4 100644 --- a/server-adobe@2018.json +++ b/server-adobe@2018.json @@ -11,13 +11,13 @@ "rewrites":{ "enable":"true" }, - "webroot":"test-harness", - "aliases":{ + "webroot": "test-harness", + "aliases":{ "/moduleroot/cbopenai":"../" } }, "openBrowser":"false", - "cfconfig":{ - "file":".cfconfig.json" - } -} \ No newline at end of file + "cfconfig": { + "file" : ".cfconfig.json" + } +} diff --git a/server-adobe@2021.json b/server-adobe@2021.json new file mode 100644 index 0000000..11f99df --- /dev/null +++ b/server-adobe@2021.json @@ -0,0 +1,29 @@ +{ + "name":"cbopenai-adobe@2021", + "app":{ + "serverHomeDirectory":".engine/adobe2021", + "cfengine":"adobe@2021" + }, + "web":{ + "http":{ + "port":"60299" + }, + "rewrites":{ + "enable":"true" + }, + "webroot": "test-harness", + "aliases":{ + "/moduleroot/cbopenai":"../" + } + }, + "jvm":{ + "heapSize":"1024" + }, + "openBrowser":"false", + "cfconfig": { + "file" : ".cfconfig.json" + }, + "scripts" : { + "onServerInstall":"cfpm install zip,debugger" + } +} diff --git a/server-adobe@2023.json b/server-adobe@2023.json new file mode 100644 index 0000000..39db375 --- /dev/null +++ b/server-adobe@2023.json @@ -0,0 +1,29 @@ +{ + "name":"cbopenai-adobe@2023", + "app":{ + "serverHomeDirectory":".engine/adobe2023", + "cfengine":"adobe@2023.0.0-beta.1" + }, + "web":{ + "http":{ + "port":"60299" + }, + "rewrites":{ + "enable":"true" + }, + "webroot": "test-harness", + "aliases":{ + "/moduleroot/cbopenai":"../" + } + }, + "jvm":{ + "heapSize":"1024" + }, + "openBrowser":"false", + "cfconfig": { + "file" : ".cfconfig.json" + }, + "scripts" : { + "onServerInstall":"cfpm install zip,debugger" + } +} diff --git a/server-lucee@5.json b/server-lucee@5.json index bcccbd5..97e7d13 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/cbopenai":"../" } }, "openBrowser":"false", - "cfconfig":{ - "file":".cfconfig.json" - } -} \ No newline at end of file + "cfconfig": { + "file" : ".cfconfig.json" + } +} diff --git a/test-harness/.cfconfig.json b/test-harness/.cfconfig.json deleted file mode 100644 index 1af3093..0000000 --- a/test-harness/.cfconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "debuggingEnabled":false, - "debuggingReportExecutionTimes":false, - "disableInternalCFJavaComponents":false, - "inspectTemplate":"always", - "requestTimeout":"0,0,0,90", - "robustExceptionEnabled":true -} \ No newline at end of file diff --git a/test-harness/Application.cfc b/test-harness/Application.cfc index 07baec6..331cdc7 100644 --- a/test-harness/Application.cfc +++ b/test-harness/Application.cfc @@ -47,6 +47,23 @@ component{ this.mappings[ "/moduleroot" ] = moduleRootPath; this.mappings[ "/#request.MODULE_NAME#" ] = modulePath; + // ORM definitions: ENABLE IF NEEDED + //this.datasource = "coolblog"; + //this.ormEnabled = "true"; + /** + this.ormSettings = { + cfclocation = [ "models" ], + logSQL = true, + dbcreate = "update", + secondarycacheenabled = false, + cacheProvider = "ehcache", + flushAtRequestEnd = false, + eventhandling = true, + eventHandler = "cborm.models.EventHandler", + skipcfcWithError = true + }; + **/ + // 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 ); @@ -57,6 +74,14 @@ component{ // request start public boolean function onRequestStart(String targetPage){ + if( url.keyExists( "fwreinit" ) ){ + if( server.keyExists( "lucee" ) ){ + pagePoolClear(); + } + // ORM reload: ENABLE IF NEEDED + // ormReload(); + } + // Process ColdBox Request application.cbBootstrap.onRequestStart( arguments.targetPage ); @@ -75,4 +100,4 @@ component{ 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 2eaa350..7db8ee8 100644 --- a/test-harness/box.json +++ b/test-harness/box.json @@ -5,25 +5,16 @@ "private":true, "description":"", "dependencies":{ - "coldbox":"^6.0.0", - "cbvalidation":"^4.3.0+24" + "coldbox":"^6.0.0" }, "devDependencies":{ - "testbox":"^4.0.0", - "route-visualizer":"^1.4.0+24" + "testbox":"*" }, "installPaths":{ "coldbox":"coldbox/", - "testbox":"testbox/", - "cbvalidation":"modules/cbvalidation/", - "route-visualizer":"modules/route-visualizer/" + "testbox":"testbox/" }, "testbox":{ "runner":"http://localhost:60299/tests/runner.cfm" - }, - "scripts":{ - "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,mysql,debugger" } -} \ No newline at end of file +} diff --git a/test-harness/config/Coldbox.cfc b/test-harness/config/Coldbox.cfc index ccf062f..55a5fe2 100644 --- a/test-harness/config/Coldbox.cfc +++ b/test-harness/config/Coldbox.cfc @@ -14,7 +14,7 @@ modulesExternalLocation = [], //Implicit Events - defaultEvent = "examples.index", + defaultEvent = "", requestStartHandler = "", requestEndHandler = "", applicationStartHandler = "", @@ -52,28 +52,27 @@ interceptors = [ ]; - // LogBox DSL + //LogBox DSL logBox = { // Define Appenders - appenders : { + appenders = { + myConsole : { class : "ConsoleAppender" }, files : { - class : "coldbox.system.logging.appenders.RollingFileAppender", - properties : { - filename : "tester", - filePath : "/#appMapping#/logs" + class="RollingFileAppender", + properties = { + filename = "tester", filePath="/#appMapping#/logs" } - }, - console : { class : "coldbox.system.logging.appenders.ConsoleAppender" } + } }, // Root Logger - root : { levelmax : "DEBUG", appenders : "*" }, + root = { levelmax="DEBUG", appenders="*" }, // Implicit Level Categories - info : [ "coldbox.system" ] + info = [ "coldbox.system" ] }; moduleSettings = { - cbopenai = { - "apiKey": getSystemSetting( "OPENAI_API_KEY", "" ) + "cbopenai" = { + "apiKey" = getSystemSetting( "OPENAI_API_KEY", "" ) } }; @@ -83,6 +82,7 @@ * Load the Module you are testing */ function afterAspectsLoad( event, interceptData, rc, prc ){ + controller.getModuleService() .registerAndActivateModule( moduleName = request.MODULE_NAME, @@ -90,4 +90,4 @@ ); } -} \ No newline at end of file +} diff --git a/test-harness/config/Router.cfc b/test-harness/config/Router.cfc old mode 100644 new mode 100755 index 73de92c..81aefde --- a/test-harness/config/Router.cfc +++ b/test-harness/config/Router.cfc @@ -1,13 +1,9 @@ -component { +component{ function configure(){ - // Your Application Routes - route( pattern="/examples/index", target="examples.index" ); - route( pattern="/examples/wireStyles", target="examples.wireStyles" ); - route( pattern="/examples/wireScripts", target="examples.wireScripts" ); - route( pattern="/examples/passParameters", target="examples.passParameters" ); - route( pattern="/examples/passedParametersProvidedToMount", target="examples.passedParametersProvidedToMount" ); - route( pattern="/examples/:component", target="examples.run" ); + setFullRewrites( true ); + + route( ":handler/:action?" ).end(); } -} +} \ No newline at end of file diff --git a/test-harness/config/WireBox.cfc b/test-harness/config/WireBox.cfc index 3aafc01..693565a 100644 --- a/test-harness/config/WireBox.cfc +++ b/test-harness/config/WireBox.cfc @@ -1,10 +1,10 @@ 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 @@ -19,28 +19,28 @@ 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/handlers/Main.cfc b/test-harness/handlers/Main.cfc index b9b4e77..f049324 100644 --- a/test-harness/handlers/Main.cfc +++ b/test-harness/handlers/Main.cfc @@ -1,15 +1,11 @@ /** - * My Event Handler Hint - */ -component { +* My Event Handler Hint +*/ +component{ // Index - any function index( event, rc, prc ){ + any function index( event,rc, prc ){ event.setView( "main/index" ); } - // Run on first init - any function onAppInit( event, rc, prc ){ - } - -} +} \ No newline at end of file diff --git a/test-harness/layouts/Main.cfm b/test-harness/layouts/Main.cfm index 30d7cfe..4af12e3 100644 --- a/test-harness/layouts/Main.cfm +++ b/test-harness/layouts/Main.cfm @@ -1,92 +1,37 @@  - - - - - - CBOPENAI Examples - - - - - - - - -
-
- -
-
- - + + + + + + + + + Module Tester + + +
+
+
+

Module Tester

+
+
+
+
+
+
+ #view()# +
-
-
-
- #renderView()# -
-
-
- - - #prc.viewJavascript# - - - - + + + + + + \ No newline at end of file diff --git a/test-harness/server-adobe@2018.json b/test-harness/server-adobe@2018.json deleted file mode 100644 index 7b22d8e..0000000 --- a/test-harness/server-adobe@2018.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name":"cbopenai-adobe@2018", - "app":{ - "serverHomeDirectory":".engine/adobe2018", - "cfengine":"adobe@2018" - }, - "web":{ - "http":{ - "port":"60299" - }, - "rewrites":{ - "enable":"true" - }, - "aliases":{ - "/modules/cbopenai":"../" - } - }, - "openBrowser":"false" -} \ No newline at end of file diff --git a/test-harness/server-adobe@2021.json b/test-harness/server-adobe@2021.json deleted file mode 100644 index 41449c3..0000000 --- a/test-harness/server-adobe@2021.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name":"cbopenai-adobe@2021", - "app":{ - "serverHomeDirectory":".engine/adobe2021", - "cfengine":"adobe@2021" - }, - "web":{ - "http":{ - "port":"60299" - }, - "rewrites":{ - "enable":"true" - }, - "aliases":{ - "/modules/cbopenai":"../" - } - }, - "openBrowser":"false" -} \ No newline at end of file diff --git a/test-harness/server-lucee@5.json b/test-harness/server-lucee@5.json deleted file mode 100644 index d58d2e0..0000000 --- a/test-harness/server-lucee@5.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name":"cbopenai-lucee@5", - "app":{ - "serverHomeDirectory":".engine/lucee5", - "cfengine":"lucee@5" - }, - "web":{ - "http":{ - "port":"60299" - }, - "rewrites":{ - "enable":"true" - }, - "aliases":{ - "/modules/cbopenai":"../" - } - }, - "openBrowser":"false" -} \ No newline at end of file diff --git a/test-harness/tests/Application.cfc b/test-harness/tests/Application.cfc index 6865e1e..f66089d 100644 --- a/test-harness/tests/Application.cfc +++ b/test-harness/tests/Application.cfc @@ -1,52 +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 { +component{ + + // The name of the module used in cfmappings ,etc + request.MODULE_NAME = "cbopenai"; + // The directory name of the module on disk. Usually, it's the same as the module name + request.MODULE_PATH = "cbopenai"; // APPLICATION CFC PROPERTIES - this.name = "ColdBoxTestingSuite" & hash( getCurrentTemplatePath() ); - this.sessionManagement = true; - this.sessionTimeout = createTimespan( 0, 0, 15, 0 ); - this.applicationTimeout = createTimespan( 0, 0, 15, 0 ); - this.setClientCookies = true; + 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; - - // UPDATE THE NAME OF THE MODULE IN TESTING BELOW - request.MODULE_NAME = "cbopenai"; + rootPath = REReplaceNoCase( this.mappings[ "/tests" ], "tests(\\|/)", "" ); + 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#"; - - // request start - public boolean function onRequestStart( String targetPage ){ - if ( url.keyExists( "fwreinit" ) ) { - if ( structKeyExists( server, "lucee" ) ) { + moduleRootPath = REReplaceNoCase( rootPath, "#request.MODULE_PATH#(\\|/)test-harness(\\|/)", "" ); + this.mappings[ "/moduleroot" ] = moduleRootPath; + this.mappings[ "/#request.MODULE_NAME#" ] = moduleRootPath & "#request.MODULE_PATH#"; + + // 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 function onRequestEnd(){ - // CB 6 graceful shutdown - if ( !isNull( application.cbController ) ) { - application.cbController.getLoaderService().processShutdown(); - } - - structDelete( application, "cbController" ); - structDelete( application, "wirebox" ); + 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/index.cfm b/test-harness/tests/index.cfm index 0ccfa80..8ae931e 100644 --- a/test-harness/tests/index.cfm +++ b/test-harness/tests/index.cfm @@ -16,6 +16,9 @@ + + + @@ -55,6 +58,7 @@ + @@ -65,7 +69,7 @@
- +
v#testbox.getVersion()#
@@ -85,7 +89,7 @@
Contents: #executePath# -

+

@@ -94,7 +98,7 @@ - ✚ #qResults.name#
+ #qResults.name#
target="_blank"
>#qResults.name#
@@ -112,4 +116,4 @@ - \ No newline at end of file + diff --git a/test-harness/tests/resources/coolblog.sql b/test-harness/tests/resources/coolblog.sql new file mode 100644 index 0000000..d1af264 --- /dev/null +++ b/test-harness/tests/resources/coolblog.sql @@ -0,0 +1,473 @@ +# ************************************************************ +# Sequel Pro SQL dump +# Version 4529 +# +# http://www.sequelpro.com/ +# https://github.com/sequelpro/sequelpro +# +# Host: Localhost (MySQL 5.6.21) +# Database: coolblog +# Generation Time: 2016-02-27 23:03:57 +0000 +# ************************************************************ + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + + +# Dump of table blogEntries +# ------------------------------------------------------------ +USE `coolblog`; + +DROP TABLE IF EXISTS `blogEntries`; + +CREATE TABLE `blogEntries` ( + `blogEntriesID` int(11) NOT NULL AUTO_INCREMENT, + `blogEntriesLink` longtext NOT NULL, + `blogEntriesTitle` longtext NOT NULL, + `blogEntriesDescription` longtext NOT NULL, + `blogEntriesDatePosted` datetime NOT NULL, + `blogEntriesdateUpdated` datetime NOT NULL, + `blogEntriesIsActive` bit(1) NOT NULL, + `blogsID` int(11) DEFAULT NULL, + PRIMARY KEY (`blogEntriesID`), + KEY `FK2828728E45296FD` (`blogsID`), + CONSTRAINT `FK2828728E45296FD` FOREIGN KEY (`blogsID`) REFERENCES `blogs` (`blogsID`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +LOCK TABLES `blogEntries` WRITE; +/*!40000 ALTER TABLE `blogEntries` DISABLE KEYS */; + +INSERT INTO `blogEntries` (`blogEntriesID`, `blogEntriesLink`, `blogEntriesTitle`, `blogEntriesDescription`, `blogEntriesDatePosted`, `blogEntriesdateUpdated`, `blogEntriesIsActive`, `blogsID`) +VALUES + (1,'http://blog.coldbox.org/post.cfm/coldbox-wiki-docs-skins-shared','ColdBox Wiki Docs Skins Shared','Since we love collaboration and giving back to the community, we have just opened our Wiki Docs Skins github repository so you can check out how we build out our wiki docs skins for CodexWiki and hopefully you guys can send us your skins and we can use them on the wiki docs site :)','2011-04-06 11:13:52','2011-04-06 11:13:52',b'1',1), + (2,'http://blog.coldbox.org/post.cfm/new-coldbox-wiki-docs','New ColdBox Wiki Docs','We have been wanting to update all our sites for a long time and the docs where first. Yesterday we updated our codex skins for the coldbox wiki docs and also started our documentation revisions and updates. You will see that it is now much much better organized and our new quick index feature enables you to get to content even faster. Hopefully in the coming weeks we will have all our documentation updated and running. Thank you for your support and feedback.','2011-04-06 10:57:17','2011-04-06 10:57:17',b'1',1), + (3,'http://blog.coldbox.org/post.cfm/modules-contest-ends-this-friday','Modules Contest Ends This Friday','Just a quick reminder that our Modules Contest ends this Friday! So get to it, build some apps! Modules Contest URL: http://blog.coldbox.org/post.cfm/coldbox-modules-contest-extended','2011-04-04 11:22:19','2011-04-04 11:22:19',b'1',1), + (4,'http://blog.coldbox.org/post.cfm/coldbox-connection-recording-coldbox-3-0-0','ColdBox Connection Recording: ColdBox 3.0.0','Thanks for attending our 3rd ColdBox Connection webinar today!  This webinar focused on ColdBox 3.0.0 release and goodies.  Here is the recording for the show!','2011-03-30 15:42:16','2011-03-30 15:42:16',b'1',1), + (5,'http://blog.coldbox.org/post.cfm/coldbox-platform-3-0-0-released','ColdBox Platform 3.0.0 Released','\n \n \nI am so happy to finally announce ColdBox Platform 3.0.0 today on March 3.0, 2011. It has been over a year of research, testing, development, coding, long long nights, 1 beautiful baby girl, lots of headaches, lots of smiles, inspiration, blessings, new contributors, new team members, new company, new hopes, and ambitions. Overall, what an incredible year for ColdFusion and ColdBox development. I can finally say that this release has been the most ambitious release and project I have tackled in my entire professional life. I am so happy of the results and its incredible community response and involvement. So thank you so much Team ColdBox and all the community for the support and long hours of testing, ideas and development.\nColdBox 3 has been on a journey of 6 defined milestones and 2 release candidates in a spawn of over a year of development. Our vision was revamping the engine into discrete and isolated parts:\n\nCore\nLogBox : Enterprise Logging Library\nWireBox : Enterprise Dependency Injection and AOP framework\nCacheBox : Enterprise Caching Engine & Cache Aggregator\nMockBox : Mocking/Stubbing Framework\n\nAll of these parts are now standalone and can be used with any ColdFusion application or ColdFusion framework. We believe we build great tools and would like everybody to have access to them even though they might not even use ColdBox MVC. Apart from the incredible amount of enhancements, we also ventured into several incredible new features:\n\nWhat\'s New\nColdBox Modules : Bringing Modular Architecture to ANY ColdBox application\nProgrammatic configuration, no more XML\nIncredible caching enhancements and integrations\nExtensible and enterprise dependency injection\nAspect oriented programming\nIntegration testing, mocking, stubbing and incredible amount of tools for testing and verification\nCustomizable Flash RAM and future web flows\nColdFusion ORM and Hibernate Services\nRESTful web services enhancement and easy creations\nTons more\n\n \nThe What\'s New page can say it all! An incredible more than 700 issue tickets closed and ColdBox 3.1 is already in full planning phases. So apart from all this work culminating, we can also say we have transitioned into a complete professional open source software offering an incredible amount of professional services and backup to any enterprise or company running ColdBox or any of our supporting products (Relax, CodexWiki, ForumMan, DataBoss, Messaging, ...):\n\nSupport & Mentoring Plans\nArchitecture & Design\nOver 4 professional training courses\nServer Setup, Tuning and Optimizations\nCustom Consulting and','2011-03-29 23:30:18','2011-03-29 23:30:18',b'1',1), + (6,'http://blog.coldbox.org/post.cfm/cachebox-1-2-released','CacheBox 1.2 Released','\n \n In the spirit of more releases, here is: CacheBox 1.2.0.  CacheBox is an enterprise caching engine, aggregator and API for ColdFusion applications. It is part of the ColdBox 3.0.0 Platform but it can also function on its own as a standalone framework and use it in any ColdFusion application and in any ColdFusion framework. \nThe milestone page for this release can be found in our Assembla Code Tracker. Here is a synopsis of the tickets closed:\n \n\n \n\n1179 new cachebox store: BlackholeStore used for optimization and testing\n1180 cf store does not use createTimeSpan to create minute timespans for puts\n1181 railo store does not use createTimeSpan to create minute timespans for puts\n1182 updates to make it coldbox 3.0 compatible\n1192 store locking mechanisms updated to improve locking and concurrency\n\nSo have fun playing with our new CacheBox release:\n\nDownload\nCheatsheet\nSource Code\nDocumentation\n\n ','2011-03-29 23:26:09','2011-03-29 23:26:09',b'1',1), + (7,'http://blog.coldbox.org/post.cfm/wirebox-1-1-1-released','WireBox 1.1.1 Released!','I am happy to announce WireBox 1.1.1 to the ColdFusion community. This release sports 3 critical fixes that will make your WireBox injectors run smoother and happier, especially for those doing java integration, this will help you some more.\n\n\nDownload\nCheatsheet\nSource Code\nDocumentation\nOur primer: Getting Jiggy Wit It!\n\n Issues Fixed\n\n1184 changed way providers accessed scoped injectors via scope registration structure instead of injector references to avoid memory leaks\n 1188 updated the java builder to ignore empty init arguments.\n 1189 updated the java builder to do noInit() as it was ignoring it\n','2011-03-29 23:20:32','2011-03-29 23:20:32',b'1',1), + (8,'http://blog.coldbox.org/post.cfm/module-lifecycles-explained','Module Lifecycles Explained','In this short entry I just wanted to lay out a few new diagrams that explain the lifecycle of ColdBox modules.  As always, all our documentation reflects these changes as well.  This might help some of you developers getting ready to win that ColdBox Modules contest and get some cash and beer!\n\nModule Service\nThe beauty of ColdBox Modules is that you have an internal module service that you can tap to in order to dynamically interact with the ColdBox Modules. This service is available by talking to the main ColdBox controller and calling its getModuleService() method: \n// get module service from handlers, plugins, layouts, interceptors or views.\nms = controller.getModuleService();\n\n// You can also inject it via our autowire DSL\nproperty name=\"moduleService\" inject=\"coldbox:moduleService\";\n\n \nModule Lifecycle\n\n \n\nHowever, before we start reviewing the module service methods let\'s review how modules get loaded in a ColdBox application. Below is a simple bullet point of what happens in your application when it starts up and you can also look at the diagram above: \n\nColdBox main application and configuration loads \nColdBox Cache, Logging and WireBox are created \nModule Service calls on registerAllModules() to read all the modules in the modules locations (with include/excludes) and start registering their configurations one by one. If the module had parent settings, interception points, datasoures or webservices, these are registered here. \nAll main application interceptors are loaded and configured \nColdBox is marked as initialized \nModule service calls on activateAllModules() so it begins activating only the registered modules one by one. This registers the module\'s SES URL Mappings, model objects, etc \nafterConfigurationLoad interceptors are fired \nColdBox aspects such as i18n, javaloader, ColdSpring/LightWire factories are loaded \nafterAspectsLoad interceptors are fired \n\nThe most common methods that you can use to control the modules in your application are the following: \n\nreloadAll() : Reload all modules in the application. This clears out all module settings, re-registers from disk, re-configures them and activates them \nreload(module) : Target a module reload by name \nunloadAll() : Unload all modules \nunload(module) : Target a module unload by name \nregisterAllModules() : Registers all module configurations \nregisterModule(module) : Target a module configuration registration \nactivateAllModules() : Activate all registered modules \nactivateModule(module) : Target activate a module that has been registered already \ngetLoadedModules() : Get an array of loaded module names \nrebuildModuleRegistry() : Rescan all the module lcoations for newly installed modules and rebuild the registry so these modules can be registered and activated. \nregisterAndActivateModule(module) : Registe','2011-03-29 11:42:49','2011-03-29 11:42:49',b'1',1), + (9,'http://blog.coldbox.org/post.cfm/coldbox-connection-show-wednesday','ColdBox Connection Show Wednesday','Just a reminder that this March 3.0.0, 2011 we will be holding a special ColdBox Open Forum Connection at 9 AM PST.  You can find more information below:Location:  http://experts.adobeconnect.com/coldbox-connection/ColdBox Connection Shows: http://www.coldbox.org/media/connectionWatch out!! Something is coming!!','2011-03-28 20:59:29','2011-03-28 20:59:29',b'1',1), + (10,'http://blog.coldbox.org/post.cfm/coldbox-modules-contest-extended','ColdBox Modules Contest Extended','We are extending our Modules Contest to allow for more time for entries to trickle in and of course to leverage ColdBox 3 coming this week.\nDeadline: Module entries must be submitted by March 29th EXTENDED: April 8th, 2011 no later than 12PM PST to contests@ortussolutions.com\nWinners Announced on March 30th EXTENDED: April 14th, 2011 The ColdBox Connection show at 9AM PST\nColdBox 3.0 Modules ContestCreate a ColdBox 3.0.0 module that is a fully functional application that can be portable for any ColdBox 3.0 application. Here are some guidelines the ColdBox team will be evaluating the module on\n\nDownload ColdBox\n\nThe code must reside on either github or a public repository so it is publicly accessible\n\nThe user must create a forgebox entry and submit the module code to it: http://coldbox.org/forgebox\n\nThe more internal libraries it uses the more points it gets: LogBox, MockBox, WireBox, CacheBox\n\nThe module should do something productive, no say hello modules accepted\n\nBest practices on MVC separation of concerns\n\nPortability\n\nDocumentation (You had that one coming!!) as it might need DB setup or DSN setup\n\nBe creative!\n\nMake sure it works!\n\n\n1st Prize\n\nAn Adobe ColdFusion 9 Standard License\n\n$100 Amazon Gift Card\n\nSix pack of \"BrewFather\" beer\n\n\n2nd Prize\n\nA ColdBox Book\n\nA ColdBox T-Shirt\n\n$25 Amazon Gift Card\n\nSix pack of \"BrewFather\" beer\n','2011-03-27 20:29:07','2011-03-27 20:29:07',b'1',1), + (11,'http://blog.coldbox.org/post.cfm/coldbox-3-release-training-special-discounts','ColdBox 3 Release Training Special Discounts','\n We are currently holding a special promotion that starts today March 27, 2011 until April 3rd, 2011\n at 3:00 PM PST. Take advantage of this insane $300 off any training of your choice in honor \n of our ColdBox 3.0.0 release this week.  Just use our discount code \n viva3 in our training registration pages or follow our links below and get this discount. \n Hurry as the code expires on April 3rd, 2011 at 3PM PST.\n \n \nCalifornia Ontario/Los Angeles Training - April 27 to May 1, 2011\n\nDiscount Link: http://coldbox.eventbrite.com/?discount=viva3 \nCBOX-101 ColdBox Core on April 27 - April 29, 2011\nCBOX-203 ColdBox Modules on April 30 - May 1, 2011\n\nPre-CFObjective Minneapolis Training - May 10-11, 2011\n\nDiscount Link: http://coldbox-cfobjective.eventbrite.com/?discount=viva3 \nCBOX-100 ColdBox Core on May 10-11, 2011\nCBOX-202 WireBox Dependency Injection on May 10-11, 2011\n\nHouston, Texas Training - April 27 to May 1, 2011\n\nDiscount Link: http://coldbox-texas.eventbrite.com/?discount=viva3 \nCBOX-101 ColdBox Core on July 6-8, 2011\nCBOX-203 ColdBox Modules on July 7-8, 2011\n','2011-03-27 20:18:44','2011-03-27 20:18:44',b'1',1), + (12,'http://blog.coldbox.org/post.cfm/coldbox-connection-recordings-page','ColdBox Connection Recordings Page','We just created our new recordings page for the ColdBox Connection today, so you can get in one location all of the recordings.  Hopefully in the near future we will expand it with tags and search.','2011-03-25 11:36:08','2011-03-25 11:36:08',b'1',1), + (13,'http://blog.coldbox.org/post.cfm/coldbox-connection-recording-coldbox-modules','ColdBox Connection Recording: ColdBox Modules','Thanks for attending our 2nd ColdBox Connection webinar today!  This webinar focused on ColdBox modules, modularity and architecture.  Thanks go to Curt Gratz for presenting such excellent topic.  Here is the recording for the show and also please note that we will have another show March 3.0!','2011-03-24 11:41:53','2011-03-24 11:41:53',b'1',1), + (14,'http://blog.coldbox.org/post.cfm/coldbox-connection-thursday-modules','ColdBox Connection Thursday: Modules','Just a reminder that our ColdBox Connection Show continues this Thursday at 9 AM PST! Curt Gratz will be presenting on ColdBox Modules and of course we will all be there for questions and help. See you there!Location: http://experts.adobeconnect.com/coldbox-connection/Our full calendar of events can be found here: http://coldbox.org/about/eventscalendar','2011-03-22 08:48:10','2011-03-22 08:48:10',b'1',1), + (15,'http://blog.coldbox.org/post.cfm/coldbox-relax-v1-4-released','ColdBox Relax v1.4 released!','Here is a cool new update for ColdBox Relax - RESTful Tools For Lazy Experts!  This update fixes a few issues reported and also enhances the Relaxer console and updates its ability to support definitions for multiple tiers and much more. So download it now!\nHere are the closed issues for this release:\n\n #14 api_logs direct usage reference removed fixes\n #15 basic http authentication added to relaxer console so you can easily hit resources that require basic auth\n #10 entry points can now be a structure of name value pairs for multiple tiers\n #16 new browser results tab window to show how the results are rendered by a browser\n #17 addition http proxy as advanced settings to relaxer console so you can proxy your relaxed requests\n #11 Route Auto Generation - Method security fixes so implicit structures are generated alongside json structures\n\nHere is also a nice screencast showcasing version 1.4 capabilities:\n \n\n\n\n \nWhat is Relax? ColdBox Relax is a set of RESTful tools for lazy experts. We pride ourselves in helping developers work smarter and of course document more in less time by providing them the necessary tools to automagically document and test. ColdBox Relax is a way to describe RESTful web services, test RESTful web services, monitor RESTful web services and document RESTful web services. The following introductory video will explain it better than words!\n \n\n\n\nSo what are you waiting for? Get Relax Now!\n\n Source Code\n Download\n Documentation\n\n \n','2011-03-21 16:51:09','2011-03-21 16:51:09',b'1',1); + +/*!40000 ALTER TABLE `blogEntries` ENABLE KEYS */; +UNLOCK TABLES; + + +# Dump of table blogs +# ------------------------------------------------------------ + +DROP TABLE IF EXISTS `blogs`; + +CREATE TABLE `blogs` ( + `blogsID` int(11) NOT NULL AUTO_INCREMENT, + `blogsURL` longtext NOT NULL, + `blogsWebsiteurl` longtext NOT NULL, + `blogslanguage` varchar(10) NOT NULL, + `blogsTitle` longtext NOT NULL, + `blogsDescription` longtext NOT NULL, + `blogsdateBuilt` datetime NOT NULL, + `blogsdateSumitted` datetime NOT NULL, + `blogsIsActive` bit(1) NOT NULL, + `blogsAuthorname` varchar(200) DEFAULT NULL, + `blogsauthorEmail` varchar(200) DEFAULT NULL, + `blogsauthorURL` longtext, + PRIMARY KEY (`blogsID`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +LOCK TABLES `blogs` WRITE; +/*!40000 ALTER TABLE `blogs` DISABLE KEYS */; + +INSERT INTO `blogs` (`blogsID`, `blogsURL`, `blogsWebsiteurl`, `blogslanguage`, `blogsTitle`, `blogsDescription`, `blogsdateBuilt`, `blogsdateSumitted`, `blogsIsActive`, `blogsAuthorname`, `blogsauthorEmail`, `blogsauthorURL`) +VALUES + (1,'http://blog.coldbox.org/feeds/rss.cfm','http://blog.coldbox.org/','','ColdBox Platform','The official ColdBox Blog','2011-04-08 15:19:13','2011-04-08 15:19:13',b'1',NULL,NULL,NULL); + +/*!40000 ALTER TABLE `blogs` ENABLE KEYS */; +UNLOCK TABLES; + + +# Dump of table cacheBox +# ------------------------------------------------------------ + +DROP TABLE IF EXISTS `cacheBox`; + +CREATE TABLE `cacheBox` ( + `id` varchar(100) NOT NULL, + `objectKey` varchar(255) NOT NULL, + `objectValue` longtext NOT NULL, + `hits` int(11) NOT NULL DEFAULT '1', + `timeout` int(11) NOT NULL, + `lastAccessTimeout` int(11) NOT NULL, + `created` datetime NOT NULL, + `lastAccessed` datetime NOT NULL, + `isExpired` tinyint(4) NOT NULL DEFAULT '1', + `isSimple` tinyint(4) NOT NULL DEFAULT '0', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +LOCK TABLES `cacheBox` WRITE; +/*!40000 ALTER TABLE `cacheBox` DISABLE KEYS */; + +INSERT INTO `cacheBox` (`id`, `objectKey`, `objectValue`, `hits`, `timeout`, `lastAccessTimeout`, `created`, `lastAccessed`, `isExpired`, `isSimple`) +VALUES + ('DF658A103F07DC012AB905014C32D4C7','myKey','hello',1,0,0,'2016-02-25 16:34:00','2016-02-25 16:34:00',1,1); + +/*!40000 ALTER TABLE `cacheBox` ENABLE KEYS */; +UNLOCK TABLES; + + +# Dump of table categories +# ------------------------------------------------------------ + +DROP TABLE IF EXISTS `categories`; + +CREATE TABLE `categories` ( + `category_id` varchar(50) NOT NULL, + `category` varchar(100) NOT NULL, + `description` varchar(100) NOT NULL, + `modifydate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `testValue` varchar(100) DEFAULT NULL, + PRIMARY KEY (`category_id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +LOCK TABLES `categories` WRITE; +/*!40000 ALTER TABLE `categories` DISABLE KEYS */; + +INSERT INTO `categories` (`category_id`, `category`, `description`, `modifydate`, `testValue`) +VALUES + ('3A2C516C-41CE-41D3-A9224EA690ED1128','Presentations','

Presso

','2011-02-18 00:00:00',NULL), + ('40288110380cda3301382644c7f90008','LM','LM
','2012-06-10 23:00:00',NULL), + ('402881882814615e012826481061000c','Marc','This is marcs category
','2010-04-21 22:00:00',NULL), + ('402881882814615e01282bb047fd001e','Cool Wow','A cool wow category
','2010-04-22 22:00:00',NULL), + ('402881882b89b49b012b9201bda80002','PascalNews','PascalNews','2010-10-09 00:00:00',NULL), + ('402881a144f57bfd0144fa47bf040007','ads','asdf','2014-01-25 00:00:00',NULL), + ('5898F818-A9B6-4F5D-96FE70A31EBB78AC','Release','

Releases

','2009-04-18 11:48:53',NULL), + ('88B689EA-B1C0-8EEF-143A84813ACADA35','general','A general category','2010-03-31 12:53:21',NULL), + ('88B689EA-B1C0-8EEF-143A84813BCADA35','general','A second test general category','2010-03-31 12:53:21',NULL), + ('88B6C087-F37E-7432-A13A84D45A0F703B','News','A news cateogyr','2009-04-18 11:48:53',NULL), + ('99fc94fd3b98c834013b98c9b2140002','Fancy','Fancy Editor
','2012-12-14 00:00:00',NULL), + ('99fc94fd3b9a459d013b9db89c060002','Markus','Hello Markus
','2012-12-14 15:00:00',NULL), + ('A13C0DB0-0CBC-4D85-A5261F2E3FCBEF91','Training','unittest','2014-05-07 19:05:21',NULL), + ('ff80808128c9fa8b0128cc3af5d90007','Geeky Stuff','Geeky Stuff','2010-05-25 16:00:00',NULL), + ('ff80808128c9fa8b0128cc3b20bf0008','ColdBox','ColdBox','2010-05-23 16:00:00',NULL), + ('ff80808128c9fa8b0128cc3b7cdd000a','ColdFusion','ColdFusion','2010-05-23 16:00:00',NULL); + +/*!40000 ALTER TABLE `categories` ENABLE KEYS */; +UNLOCK TABLES; + + +# Dump of table comments +# ------------------------------------------------------------ + +DROP TABLE IF EXISTS `comments`; + +CREATE TABLE `comments` ( + `comment_id` varchar(50) NOT NULL, + `FKentry_id` varchar(50) NOT NULL, + `comment` text NOT NULL, + `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`comment_id`), + KEY `FK_comments_1` (`FKentry_id`), + KEY `FKentry_id` (`FKentry_id`), + CONSTRAINT `comments_ibfk_1` FOREIGN KEY (`FKentry_id`) REFERENCES `entries` (`entry_id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +LOCK TABLES `comments` WRITE; +/*!40000 ALTER TABLE `comments` DISABLE KEYS */; + +INSERT INTO `comments` (`comment_id`, `FKentry_id`, `comment`, `time`) +VALUES + ('40288110380cda330138265bf9c4000a','8a64b3712e3a0a5e012e3a11a2cf0004','tt','2012-06-12 23:00:00'), + ('40288110380cda3301382c7fe50d0012','88B82629-B264-B33E-D1A144F97641614E','Test','2012-06-06 23:00:00'), + ('402881882814615e01282b13bbc20013','88B82629-B264-B33E-D1A144F97641614E','This entire blog post really offended me, I hate you','2010-04-22 22:00:00'), + ('402881882814615e01282b13fb290014','88B82629-B264-B33E-D1A144F97641614E','Why are you so hurtful man!','2010-04-22 22:00:00'), + ('402881882814615e01282b142cc60015','88B82629-B264-B33E-D1A144F97641614E','La realidad, que barbaro!','2010-04-22 22:00:00'), + ('88B8C6C7-DFB7-0F34-C2B0EFA4E5D7DA4C','88B82629-B264-B33E-D1A144F97641614E','this blog sucks.','2010-09-02 11:39:04'), + ('8a64b3712e3a0a5e012e3a10321d0002','402881882814615e01282b14964d0016','Vlad is awesome!','2011-02-18 00:00:00'), + ('8a64b3712e3a0a5e012e3a12b1d10005','8a64b3712e3a0a5e012e3a11a2cf0004','Vlad is awesome!','2011-02-18 00:00:00'); + +/*!40000 ALTER TABLE `comments` ENABLE KEYS */; +UNLOCK TABLES; + + +# Dump of table contact +# ------------------------------------------------------------ + +DROP TABLE IF EXISTS `contact`; + +CREATE TABLE `contact` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `firstName` varchar(255) DEFAULT NULL, + `lastName` varchar(255) DEFAULT NULL, + `email` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +LOCK TABLES `contact` WRITE; +/*!40000 ALTER TABLE `contact` DISABLE KEYS */; + +INSERT INTO `contact` (`id`, `firstName`, `lastName`, `email`) +VALUES + (1,'Luis','Majano','lmajano@ortussolutions.com'), + (2,'Jorge','Reyes','lmajano@gmail.com'), + (3,'','',''); + +/*!40000 ALTER TABLE `contact` ENABLE KEYS */; +UNLOCK TABLES; + + +# Dump of table entries +# ------------------------------------------------------------ + +DROP TABLE IF EXISTS `entries`; + +CREATE TABLE `entries` ( + `entry_id` varchar(50) NOT NULL, + `entryBody` text NOT NULL, + `title` varchar(50) NOT NULL, + `postedDate` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `FKuser_id` varchar(36) NOT NULL, + PRIMARY KEY (`entry_id`), + KEY `FKuser_id` (`FKuser_id`), + CONSTRAINT `entries_ibfk_1` FOREIGN KEY (`FKuser_id`) REFERENCES `users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='InnoDB free: 9216 kB; (`FKuser_id`) REFER `coolblog/users`(`'; + +LOCK TABLES `entries` WRITE; +/*!40000 ALTER TABLE `entries` DISABLE KEYS */; + +INSERT INTO `entries` (`entry_id`, `entryBody`, `title`, `postedDate`, `FKuser_id`) +VALUES + ('402881882814615e01282b14964d0016','Wow, welcome to my new blog, enjoy your stay
','My awesome post','2010-04-22 22:00:00','88B73A03-FEFA-935D-AD8036E1B7954B76'), + ('88B82629-B264-B33E-D1A144F97641614E','A first cool blog,hope it does not crash','A cool blog first posting','2009-04-08 00:00:00','88B73A03-FEFA-935D-AD8036E1B7954B76'), + ('8a64b3712e3a0a5e012e3a11a2cf0004','ContentBox is a professional open source modular content management engine that allows you to easily build websites adfsadf adfsadf asfddasfddasfddasfdd','My First Awesome Post My First Awesome Post','2013-04-16 22:00:00','88B73A03-FEFA-935D-AD8036E1B7954B76'), + ('8aee965b3cfff278013d0007d9540002','Mobile browsing popularity is skyrocketing.  According to a new Pew Internet Project report, 25% of Americans use smartphones instead of computers for the majority of their web browsing.\r\nMissing out on the mobile marketing trend is\r\n likely to translate into loss of market share and decreased sales. \r\nThat’s not to say that it’s right for every business, but you at least \r\nneed to consider your target market persona before simply dismissing \r\nmobile as a fad.\r\nOne simple step you can take in the mobile direction is to learn how to add Apple icons to your website.\r\n

What Are Apple Icons & Why Use Them?

\r\n\"GuavaBoxApple\r\n Icons are simply the graphics you’ve chosen to represent your site when\r\n a user saves your page to their home screen in iOS.\r\nIf you don’t have Apple Icons created for your site, iOS grabs a \r\ncompressed thumbnail of your website and displays it as the icon.  The \r\nresult is typically indistinguishable and unappealing.\r\nApple Icons are an awesome branding opportunity and give you the chance to g
','Test','2013-04-23 00:00:00','402884cc310b1ae901311be89381000a'), + ('99fc94fd3ba7f266013bad4a8a3b0004','This is my first blog post from Bern!
','This is my first blog post from Bern!','2012-12-17 15:00:00','99fc94fd3ba7f266013bad49e3c50003'); + +/*!40000 ALTER TABLE `entries` ENABLE KEYS */; +UNLOCK TABLES; + + +# Dump of table entry_categories +# ------------------------------------------------------------ + +DROP TABLE IF EXISTS `entry_categories`; + +CREATE TABLE `entry_categories` ( + `FKcategory_id` varchar(50) NOT NULL, + `FKentry_id` varchar(50) NOT NULL, + KEY `FKcategory_id` (`FKcategory_id`), + KEY `FKentry_id` (`FKentry_id`), + CONSTRAINT `entry_categories_ibfk_1` FOREIGN KEY (`FKcategory_id`) REFERENCES `categories` (`category_id`) ON DELETE CASCADE ON UPDATE CASCADE, + CONSTRAINT `entry_categories_ibfk_2` FOREIGN KEY (`FKentry_id`) REFERENCES `entries` (`entry_id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +LOCK TABLES `entry_categories` WRITE; +/*!40000 ALTER TABLE `entry_categories` DISABLE KEYS */; + +INSERT INTO `entry_categories` (`FKcategory_id`, `FKentry_id`) +VALUES + ('88B689EA-B1C0-8EEF-143A84813ACADA35','88B82629-B264-B33E-D1A144F97641614E'), + ('88B6C087-F37E-7432-A13A84D45A0F703B','88B82629-B264-B33E-D1A144F97641614E'), + ('3A2C516C-41CE-41D3-A9224EA690ED1128','99fc94fd3ba7f266013bad4a8a3b0004'), + ('5898F818-A9B6-4F5D-96FE70A31EBB78AC','99fc94fd3ba7f266013bad4a8a3b0004'), + ('99fc94fd3b98c834013b98c9b2140002','99fc94fd3ba7f266013bad4a8a3b0004'), + ('5898F818-A9B6-4F5D-96FE70A31EBB78AC','402881882814615e01282b14964d0016'), + ('40288110380cda3301382644c7f90008','402881882814615e01282b14964d0016'), + ('3A2C516C-41CE-41D3-A9224EA690ED1128','402881882814615e01282b14964d0016'), + ('402881882b89b49b012b9201bda80002','402881882814615e01282b14964d0016'), + ('99fc94fd3b98c834013b98c9b2140002','402881882814615e01282b14964d0016'), + ('5898F818-A9B6-4F5D-96FE70A31EBB78AC','8a64b3712e3a0a5e012e3a11a2cf0004'), + ('A13C0DB0-0CBC-4D85-A5261F2E3FCBEF91','8a64b3712e3a0a5e012e3a11a2cf0004'), + ('3A2C516C-41CE-41D3-A9224EA690ED1128','8a64b3712e3a0a5e012e3a11a2cf0004'); + +/*!40000 ALTER TABLE `entry_categories` ENABLE KEYS */; +UNLOCK TABLES; + + +# Dump of table logs +# ------------------------------------------------------------ + +DROP TABLE IF EXISTS `logs`; + +CREATE TABLE `logs` ( + `id` varchar(36) NOT NULL, + `severity` varchar(10) NOT NULL, + `category` varchar(100) NOT NULL, + `logdate` datetime NOT NULL, + `appendername` varchar(100) NOT NULL, + `message` text, + `extrainfo` text, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + + + +# Dump of table relax_logs +# ------------------------------------------------------------ + +DROP TABLE IF EXISTS `relax_logs`; + +CREATE TABLE `relax_logs` ( + `id` varchar(36) NOT NULL, + `severity` varchar(10) NOT NULL, + `category` varchar(100) NOT NULL, + `logdate` datetime NOT NULL, + `appendername` varchar(100) NOT NULL, + `message` longtext, + `extrainfo` longtext, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + + + +# Dump of table roles +# ------------------------------------------------------------ + +DROP TABLE IF EXISTS `roles`; + +CREATE TABLE `roles` ( + `roleID` int(11) NOT NULL AUTO_INCREMENT, + `role` varchar(100) DEFAULT NULL, + PRIMARY KEY (`roleID`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +LOCK TABLES `roles` WRITE; +/*!40000 ALTER TABLE `roles` DISABLE KEYS */; + +INSERT INTO `roles` (`roleID`, `role`) +VALUES + (1,'Administrator'), + (2,'Moderator'), + (3,'Anonymous'), + (4,'Super User'), + (5,'Editor'); + +/*!40000 ALTER TABLE `roles` ENABLE KEYS */; +UNLOCK TABLES; + + +# Dump of table todo +# ------------------------------------------------------------ + +DROP TABLE IF EXISTS `todo`; + +CREATE TABLE `todo` ( + `blogsID` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(100) DEFAULT NULL, + PRIMARY KEY (`blogsID`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +LOCK TABLES `todo` WRITE; +/*!40000 ALTER TABLE `todo` DISABLE KEYS */; + +INSERT INTO `todo` (`blogsID`, `name`) +VALUES + (1,'AL-{ts \'2011-04-07 11:15:55\'}'), + (2,'AL-{ts \'2011-04-07 11:16:22\'}'), + (3,'AL-{ts \'2011-04-07 11:17:06\'}'), + (4,'AL-{ts \'2011-04-07 11:21:52\'}'), + (5,'AL-{ts \'2011-04-07 11:23:06\'}'), + (6,'AL-{ts \'2011-04-07 11:23:08\'}'), + (7,'AL-{ts \'2011-04-18 17:23:59\'}'), + (8,'AL-{ts \'2011-04-18 17:37:15\'}'), + (9,'AL-{ts \'2011-04-18 17:37:20\'}'), + (10,'AL-{ts \'2011-04-18 17:38:06\'}'), + (11,'AL-{ts \'2011-04-18 17:38:08\'}'), + (12,'AL-{ts \'2011-04-18 17:38:09\'}'), + (13,'AL-{ts \'2011-04-18 17:38:10\'}'), + (14,'AL-{ts \'2011-04-18 17:38:11\'}'), + (15,'AL-{ts \'2011-04-18 17:38:12\'}'), + (16,'AL-{ts \'2011-04-18 17:38:14\'}'), + (17,'AL-{ts \'2011-04-18 17:38:15\'}'), + (18,'AL-{ts \'2011-04-18 17:38:16\'}'), + (19,'AL-{ts \'2011-04-18 17:38:17\'}'), + (20,'AL-{ts \'2011-04-18 17:38:18\'}'), + (21,'AL-{ts \'2011-04-18 17:38:19\'}'), + (22,'AL-{ts \'2011-04-18 17:38:20\'}'), + (23,'AL-{ts \'2011-04-18 17:38:21\'}'), + (24,'AL-{ts \'2011-04-18 17:40:41\'}'), + (25,'AL-{ts \'2011-04-18 17:40:44\'}'), + (26,'AL-{ts \'2011-04-18 17:40:47\'}'), + (27,'AL-{ts \'2011-04-18 17:41:38\'}'), + (28,'AL-{ts \'2011-04-18 17:44:15\'}'), + (29,'AL-{ts \'2011-04-18 17:44:25\'}'), + (30,'AL-{ts \'2011-04-18 17:44:39\'}'), + (31,'AL-{ts \'2011-04-18 17:49:44\'}'), + (32,'AL-{ts \'2011-04-18 17:50:10\'}'), + (33,'AL-{ts \'2011-04-18 17:51:07\'}'), + (34,'AL-{ts \'2011-04-18 17:57:44\'}'), + (35,'AL-{ts \'2011-04-18 18:03:33\'}'), + (36,'AL-{ts \'2011-04-18 19:32:04\'}'), + (37,'AL-{ts \'2011-04-18 19:32:08\'}'), + (38,'AL-{ts \'2011-04-18 19:32:31\'}'), + (39,'AL-{ts \'2011-04-18 19:32:51\'}'), + (40,'AL-{ts \'2011-04-18 20:02:55\'}'), + (41,'AL-{ts \'2011-04-18 20:03:52\'}'), + (42,'AL-{ts \'2011-04-18 20:04:10\'}'), + (43,'AL-{ts \'2011-04-18 20:12:52\'}'), + (44,'AL-{ts \'2011-04-19 15:43:36\'}'), + (45,'AL-{ts \'2011-04-19 15:44:20\'}'), + (46,'AL-{ts \'2011-04-19 15:48:26\'}'), + (47,'AL-{ts \'2011-04-19 15:50:59\'}'), + (48,'AL-{ts \'2011-04-19 15:51:08\'}'), + (49,'AL-{ts \'2011-04-19 15:51:15\'}'), + (50,'AL-{ts \'2011-04-23 12:58:04\'}'); + +/*!40000 ALTER TABLE `todo` ENABLE KEYS */; +UNLOCK TABLES; + + +# Dump of table users +# ------------------------------------------------------------ + +DROP TABLE IF EXISTS `users`; + +CREATE TABLE `users` ( + `user_id` varchar(50) NOT NULL, + `firstName` varchar(50) NOT NULL, + `lastName` varchar(50) NOT NULL, + `userName` varchar(50) NOT NULL, + `password` varchar(50) NOT NULL, + `lastLogin` datetime DEFAULT NULL, + `FKRoleID` int(11) DEFAULT NULL, + `isActive` bit(1) DEFAULT b'1', + PRIMARY KEY (`user_id`), + KEY `FKRoleID` (`FKRoleID`), + CONSTRAINT `users_ibfk_1` FOREIGN KEY (`FKRoleID`) REFERENCES `roles` (`roleID`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +LOCK TABLES `users` WRITE; +/*!40000 ALTER TABLE `users` DISABLE KEYS */; + +INSERT INTO `users` (`user_id`, `firstName`, `lastName`, `userName`, `password`, `lastLogin`, `FKRoleID`, `isActive`) +VALUES + ('4028818e2fb6c893012fe637c5db00a7','George','Form Injector','george','george',NULL,2,b'1'), + ('402884cc310b1ae901311be89381000a','ken','Advanced Guru','kenneth','smith','2014-03-25 00:00:00',2,b'1'), + ('4A386F4D-DCF4-6587-7B89B3BD57C97155','Joe','Fernando','joe','joe','2009-05-15 00:00:00',1,b'1'), + ('88B73A03-FEFA-935D-AD8036E1B7954B76','Luis','Majano','lui','lmajano','2009-04-08 00:00:00',1,b'1'), + ('8a64b3712e3a0a5e012e3a110fab0003','Vladymir','Ugryumov','vlad','vlad','2011-02-18 00:00:00',1,b'1'), + ('99fc94fd3b98c834013b98c928120001','Juerg','Anderegg','juerg','juerg','2012-12-14 00:00:00',NULL,b'1'), + ('99fc94fd3ba7f266013bad49e3c50003','Tanja','Zogg','tanja','tanja','2012-12-18 00:00:00',NULL,b'1'); + +/*!40000 ALTER TABLE `users` ENABLE KEYS */; +UNLOCK TABLES; + + + +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; diff --git a/test-harness/tests/runner.cfm b/test-harness/tests/runner.cfm index 790f17e..f5ec955 100644 --- a/test-harness/tests/runner.cfm +++ b/test-harness/tests/runner.cfm @@ -9,18 +9,5 @@ - - - - - - - - - - - + \ No newline at end of file diff --git a/test-harness/tests/specs/ModuleSpec.cfc b/test-harness/tests/specs/ModuleSpec.cfc new file mode 100644 index 0000000..4a2dd25 --- /dev/null +++ b/test-harness/tests/specs/ModuleSpec.cfc @@ -0,0 +1,24 @@ +component extends="coldbox.system.testing.BaseTestCase" appMapping="root" { + + /*********************************** LIFE CYCLE Methods ***********************************/ + + function beforeAll(){ + super.beforeAll(); + setup(); + } + + function afterAll(){ + super.afterAll(); + } + + /*********************************** BDD SUITES ***********************************/ + + function run(){ + describe( "MockData CFC", function(){ + beforeEach( function( currentSpec ){ + } ); + + } ); + } + +} diff --git a/test-harness/views/main/getModels.cfm b/test-harness/views/main/getModels.cfm new file mode 100644 index 0000000..34677a6 --- /dev/null +++ b/test-harness/views/main/getModels.cfm @@ -0,0 +1,5 @@ + + openAIService = getInstance( "OpenAIService@cbopenai" ); + result = openAIService.getModels(); + writeDump( result ); + \ 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..22b5e7a --- /dev/null +++ b/test-harness/views/main/index.cfm @@ -0,0 +1,7 @@ + +Module Tester + + + \ No newline at end of file