[commandbox-1.0.0+00225]coldbox create app scaffold creates CB<4 app.cfc

Hi Guys,

It’s been a while since spinning up CommandBox so i figured I would wipe out my .CommandBox dir and reinstall commandbox. I did upgrade --latest in commandbox. I made a new directory and ran coldbox create app myapp.

Ran server start errors out right away with “invalid component definition, can’t find component [coldbox.system.Coldbox]”

Thought that was odd. Realized ColdBox wasn’t installed with it. Coldbox really should be in the scaffold-ed box.json as a dependency and installed with coldbox create app. I ran install coldbox

Still erroring the same as above. Looked at the onApplicationStart and it’s using:

public boolean function onApplicationStart(){ application.cbBootstrap = new coldbox.system.Coldbox( COLDBOX_CONFIG_FILE, COLDBOX_APP_ROOT_PATH, COLDBOX_APP_KEY, COLDBOX_APP_MAPPING ); application.cbBootstrap.loadColdbox(); return true; }

Instead of the ColdBox 4 onAppStart:

public boolean function onApplicationStart(){ application.cbBootstrap = new coldbox.system.Bootstrap( COLDBOX_CONFIG_FILE, COLDBOX_APP_ROOT_PATH, COLDBOX_APP_KEY, COLDBOX_APP_MAPPING ); application.cbBootstrap.loadColdbox(); return true; }

I was looking on GitHub to submit a pull request to update the scaffold but I was having some trouble finding it

I think the default scaffold should use latest version, include ColdBox 4 as a dependency, and install it.

Thanks. Looking forward to playing a bit more.

-Dan

I think

coldbox create app myapp --installColdboxBE

worked for me

Hi Dan, thank for the feedback.

The error you received means that you are trying to run a ColdBox 3.x site using the 4.0 version of the framework. (See http://wiki.coldbox.org/wiki/Compatibility:4.0.0.cfm#ColdBox_3.x_Compatibility_Module)

We have not yet updated the CommandBox templates to default to 4.0 yet, but we will before it launches (very soon)

For now, if you with to install a 4.0 compatible application template, use the skeleton parameter to specify the name of the template

coldbox create app myApp skeleton=advancedScriptBE

Note, this is all documented in the in-command help, available here (http://integration.staging.ortussolutions.com/artifacts/ortussolutions/commandbox/be-apidocs/index.html?commandbox/commands/coldbox/create/app.html) or by typing help after the command like so:

coldbox create app help

Also note there iS a way to conventiently install ColdBox at the same time you create the application template. Just use the --installColdBox flag. Or for now, --installColdBoxBE which will automatically switch your application template to the bleeding edge (4.0) version as well. Again, this is all documented in the command help :slight_smile:

// This will install ColdBox 4.0 and a 4.0-compat template
coldbox create app myApp --installColdBoxBE

Including ColdBox as a dependency should definitely happen if it’s not already there. Note, the user would be responsible for running the "install’ command to make that happen though. I’m a little leery about doing that by default since many people don’t store ColdBox in their web root, but choose to install it elsewhere and create a mapping. Also note, if you use one of the --installColdBox flags, that WILL add a box.json and store the dependency for you, so that’s sort of our solution for people who want to kill both birds with the same stone.

The application templates are stored here:
https://github.com/bdw429s/coldbox-platform/tree/master/ApplicationTemplates

Right now it is just a manual process where Luis or i zip them up and commit them to the CommandBox repo as a zip file here:

https://github.com/Ortus-Solutions/commandbox/tree/master/src/cfml/skeletons

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Note, this is all documented in the in-command help, available here (http://integration.staging.ortussolutions.com/artifacts/ortussolutions/commandbox/be-apidocs/index.html?commandbox/commands/coldbox/create/app.html) or by typing help after the command like so:

I’m not even sure where to find those docs. They’re not the same as looking at the docs or the api docs from the commandbox page at http://www.ortussolutions.com/products/commandbox but thanks for the link.

I’m a little leery about doing that by default since many people don’t store ColdBox in their web root, but choose to install it elsewhere and create a mapping.

I understand, that makes sense, bu I tend to think it should be an “opt-out” kind of thing. Setting up a mapping is certainly an extra step and I’m not sure if that would be the norm. I think if someone wants to do that, they’d be handling that on their own. It’s a more “advanced maneuver” I think. Instead, for someone new you’re throwing errors at them right away. If you’re going to use a tool to scaffold out a project, I think it’s reasonable to expect it to be fully functional without optional parameters.

Honestly, when it comes to whether ColdBox is installed by default, I don’t really mind either way. It’s also worth noting there are --installTestBox and --installTestBoxBE flags as well. Should one of those default to being installed unless opted out?

The problem is everyone has their own way of doing it so their answers to these questions all differ a bit. For instance, Adam C told me on on Twitter that he’s disappointed that the default installation of ColdBox doesn’t separate out an app root and web root with a “public” folder containing ONLY an index.cfm and Application.cfc, with mappings configured for ColdBox and the config and all the models, handlers, views, modules, and layouts configured as external locations outside the webroot. He was gobsmacked. True story.

What I mean to say is, no matter what we do, someone will feel we got it wrong :slight_smile: If enough people chime in and agree that at least ColdBox should be installed by default, I have no issue changing it though. Heck, it’s just one line of code-- the default value of the command parameter.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com