Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
lmajano committed Dec 14, 2023
2 parents 4feaa21 + a7b645b commit ad38ea9
Show file tree
Hide file tree
Showing 8 changed files with 121 additions and 85 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ jobs:
MODULE_ID: contentbox-cli
steps:
- name: Checkout Repository
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup Java
uses: actions/setup-java@v2
uses: actions/setup-java@v3
with:
distribution: "adopt"
java-version: "11"
Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:

- name: Upload Build Artifacts
if: success()
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: Module Artifacts
path: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gh-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
create-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: taiki-e/[email protected]
with:
# Produced by the build/Build.cfc
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Checkout Repository
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup Java
uses: actions/setup-java@v2
uses: actions/setup-java@v3
with:
distribution: "adopt"
java-version: "11"
Expand Down Expand Up @@ -49,7 +49,7 @@ jobs:
runs-on: ubuntu-20.04
steps:
- name: Checkout Repository
uses: actions/checkout@v2
uses: actions/checkout@v3

- uses: Ortus-Solutions/[email protected]
with:
Expand Down
1 change: 1 addition & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@
"no-duplicate-header" : {
"siblings_only" : true
},
"no-duplicate-heading" : false,
"no-inline-html" : false
}
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ We have created the `install` and the `install-wizard` commands so you can easil
#### Suported CFML Engines

- Lucee 5+
- _Adobe 2016 (End of life December 2021)_
- Adobe 2018
- Adobe 2021

Expand Down Expand Up @@ -144,5 +143,5 @@ I THANK GOD FOR HIS WISDOM FOR THIS PROJECT

"I am the way, and the truth, and the life; no one comes to the Father, but by me (JESUS)" Jn 14:1-12

[1]: https://github.com/Ortus-Solutions/DocBox/wiki
[1]: https://docbox.ortusbooks.com/
[2]: https://github.com/Ortus-Solutions/DocBox
2 changes: 1 addition & 1 deletion box.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name":"ContentBox CLI",
"version":"1.4.0",
"version":"1.5.0",
"location":"https://downloads.ortussolutions.com/ortussolutions/commandbox-modules/contentbox-cli/@build.version@/[email protected]@.zip",
"slug":"contentbox-cli",
"author":"Ortus Solutions, Corp",
Expand Down
19 changes: 13 additions & 6 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

----

## [Unreleased]

### Added

* New Migrations approach of ContentBox 6
* New Ortus ORM extension on Lucee
* Updated server properties according to new standards


## [v1.4.0] => 2022-APR-05

### Fixed
Expand Down Expand Up @@ -57,15 +66,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

* Run initial migrations once ContentBox has been installed
* Ability to input a contentbox version to install via the `install-wizard` command.
* Ability to input a ContentBox version to install via the `install-wizard` command.

----

## [v1.0.0] => 2021-SEP-07

* Initial creation of separate CommandBox project

### Fixed

* Mispelling on database port for microsoft sql server.
* `appcfc` missing variable when updating lucee + mysql 8 bug for ddl creation.
* The initial creation of a separate CommandBox project
* Misspelling on database port for Microsoft SQL server.
* `appcfc` missing variable when updating Lucee + MySQL 8 bug for DDL creation.
167 changes: 98 additions & 69 deletions commands/contentbox/install.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ component {
return;
}

// Install the installer
// Install the ContentBox installer package according to version
variables.print
.blueLine( "Starting to install ContentBox..." )
.line()
Expand All @@ -108,61 +108,22 @@ component {
)
.run();

// ContentBox 5 ONLY, as it uses ORM DDL, 6 uses migrations
// MySQL 8 Bug on Lucee
if ( arguments.cfmlEngine.findNoCase( "lucee" ) && arguments.databaseType == "MySQL8" ) {
variables.print
.blueLine( "Lucee and MySQL 8 detected, updating Application.cfc due to Lucee ORM DDL Bug..." )
.line()
.toConsole();
var appCFC = replaceNoCase(
fileRead(
installDir & "/Application.cfc",
"utf-8"
),
"""update""",
"""dropcreate"""
);
fileWrite(
installDir & "/Application.cfc",
appCFC,
"utf-8"
);
variables.print
.greenLine( "√ Updated Application.cfc with dropcreate for MySQL 8 for initial startup." )
.line()
.toConsole();
if ( arguments.contentboxVersion eq 5 && arguments.cfmlEngine.findNoCase( "lucee" ) && arguments.databaseType == "MySQL8" ) {
contentBox5LuceeBug( installDir);
}

// Seed the right CFML Engine to deploy
if ( arguments.deployServer ) {
variables.print
.blueLine( "Starting to seed the chosen CFML Engine (#arguments.cfmlEngine#) to deploy..." )
.line()
.toConsole();

command( "server set app.cfengine=#arguments.cfmlEngine#" ).run();
command( "server set name='#arguments.name#'" ).run();
command( "server set openBrowser=false" ).run();

variables.print
.greenLine( "√ CFML Engine Configured!" )
.line()
.toConsole();
createDeployServer( arguments.cfmlEngine, arguments.name );
}

// Create the .env
variables.print
.blueLine( "Starting to seed the ContentBox runtime environment..." )
.line()
.toConsole();
arguments.installDir = installDir;
createEnvironment( argumentCollection = arguments );
variables.print
.greenLine( "√ ContentBox Environment Configured!" )
.line()
.toConsole();

// Ask for startup
// Information about the installation just in case connection details are wrong and the user can recover.
variables.print
.greenLine(
"ContentBox has been installed and configured on disk. We will now verify your database credentials, and install the database migrations."
Expand All @@ -177,49 +138,107 @@ component {
.redBoldLine( "- migrate install" )
.redBoldLine( "- run-script contentbox:migrate" );

// Run the migrations
runMigrations();

// Confirm starting up the server
if ( arguments.deployServer ) {
startupServer( arguments.cfmlEngine );
} else {
variables.print
.line()
.boldRedLine(
"* You did not deploy a server, so you must manually start your (#arguments.cfmlengine#) engine and visit the site so you can continue the web installer portions."
)
.line();
}

variables.print.greenLine( "√ ContentBox installation is done, enjoy your ContentBox!" );
}

private function runMigrations(){
// Confirm migrations
variables.print
.line()
.blueLine( "Please wait while we install your migrations table..." )
.toConsole();
sleep( 1000 );
command( "migrate install" ).run();
command( "migrate install manager='contentbox'" ).run();
command( "migrate up manager='contentbox'" ).run();
}

// Confirm starting up the server
if ( arguments.deployServer ) {
variables.print
private function startupServer( required cfmlEngine ){
variables.print
.line()
.blueLine( "Please wait while we startup your CommandBox server..." )
.toConsole();
command( "server start" ).run();
sleep( 5000 );

// Adobe 2021 cfpm installs
if ( arguments.cfmlEngine.findNoCase( "adobe@2021" ) ) {
variables.print
.line()
.blueLine( "* Adobe 2021 detected, running cfpm installs to support ContentBox..." )
.toConsole();
command( "cfpm install zip,orm,mysql,postgresql,sqlserver,document,feed" ).run();
variables.print.greenLine( "√ CFPM modules installed" );
sleep( 5000 );
}

variables.print.greenLine( "√ ContentBox server started, check out the details below:" );
command( "server info" ).run();

variables.print.greenLine( "√ Opening a browser for you to continue with the web installer..." );
command( "server open" ).run();
} else {
variables.print
.line()
.boldRedLine(
"* You did not deploy a server, so you must manually start your (#arguments.cfmlengine#) engine and visit the site so you can continue the web installer portions."
)
.line();
}

/**
* Create the the deploy server.json
*
* @cfmlEngine The CFML engine to bind the installed ContentBox instance to
* @name The name of the site to build
*/
private function createDeployServer( required cfmlEngine, required name ){
variables.print
.blueLine( "Starting to seed the chosen CFML Engine (#arguments.cfmlEngine#) to deploy..." )
.line()
.toConsole();

command( "server set name='#arguments.name#'" ).run();
command( "server set openBrowser=false" ).run();
command( "server set app.cfengine=#arguments.cfmlEngine#" ).run();
command( "server set web.rewrites.enable=true" ).run();
command( "server set jvm.heapsize=768" ).run();
command( "server set jvm.args=-Dfile.encoding=UTF8 -Dcom.sun.net.ssl.enableECC=false -Dlucee-extensions=D062D72F-F8A2-46F0-8CBC91325B2F067B" ).run();

// 2021+ cfpm installs
if ( arguments.cfmlEngine.findNoCase( "adobe@202" ) ) {
command( "server set scripts.onServerInstall=cfpm install zip,orm,mysql,postgresql,sqlserver,document,feed" ).run();
}

variables.print.greenLine( "√ ContentBox installation is done, enjoy your ContentBox!" );
variables.print
.greenLine( "√ CFML Engine Configured!" )
.line()
.toConsole();
}

/**
* This takes care of a Lucee 5 bug on MySQL 8 with ORM drop create and updates.
* This is no longer necessary in ContentBox 6 as we use migrations.
*
* @installDir The directory to the ContentBox installation
*/
private function contentBox5LuceeBug( required installDir ){
variables.print
.blueLine( "Lucee and MySQL 8 detected, updating Application.cfc due to Lucee ORM DDL Bug..." )
.line()
.toConsole();
var appCFC = replaceNoCase(
fileRead(
installDir & "/Application.cfc",
"utf-8"
),
"""update""",
"""dropcreate"""
);
fileWrite(
installDir & "/Application.cfc",
appCFC,
"utf-8"
);
variables.print
.greenLine( "√ Updated Application.cfc with dropcreate for MySQL 8 for initial startup." )
.line()
.toConsole();
}

/**
Expand All @@ -239,6 +258,11 @@ component {
required installDir,
required production
){
variables.print
.blueLine( "Starting to seed the ContentBox runtime environment..." )
.line()
.toConsole();

var env = fileRead( variables.settings.templatesPath & "/.env.template" );

env = replaceNoCase(
Expand Down Expand Up @@ -524,6 +548,11 @@ component {
env,
"utf-8"
);

variables.print
.greenLine( "√ ContentBox Environment Configured!" )
.line()
.toConsole();
}

function completeEngines(){
Expand Down

0 comments on commit ad38ea9

Please sign in to comment.