What's New in 3.3.0

Server Enhancements

The embedded CommandBox server have seen a number of nice enhancements to make it easier for you to use CommandBox for super easy local development.

Fusion Reactor Module

The more people begin to use CommandBox for local development, the more interested they became in being able to run FusionReactor on their dev servers to help trouble shoot their code. That's why we created a CommandBox FusionReactor module. It's not part of the core, but can be installed in a single command and will attach FusionReactor's server monitor to every server you start. You'll need to have a FusionReactor license or sign up for a trial to use it.
1
install commandbox-fusionreactor
2
fr register "your FR license key"
3
server start
4
fr open
Copied!

Web Aliases

CommandBox allows you to create web aliases for the web server that are similar to virtual directories. The alias path is relative to the web root, but can point to any folder on the hard drive. Aliases can be used for static or CFM files. To configure aliases for your server, create an object under web called alises. The keys are the web-accessible virtual paths and the corresponding values are the relative or absolute path to the folder the alias points to.
Here's what your server.json might look like.
1
{
2
"web" : {
3
"aliases" : {
4
"/foo" : "../bar",
5
"/js" : "C:\static\shared\javascript"
6
}
7
}
8
}
Copied!
Here's how to create aliases from the server set command:
1
server set web.aliases./foo = bar
Copied!

Custom Error Pages

You can customize the error page that CommandBox servers return. You can have a setting for each status code including a default error page to be used if no other setting applies. Create an errorPages object inside the web object in your server.json where each key is the status code integer or the word default and the value is a relative (to the web root) path to be loaded for that status code. This is what you server.json might look like:
1
{
2
"web" : {
3
"errorPages" : {
4
"404" : "/path/to/404.html",
5
"500" : "/path/to/500.html",
6
"default" : "/path/to/default.html"
7
}
8
}
9
}
Copied!
You can set error pages via the server set command like this:
1
server set web.aliases.404=/missing.htm
Copied!

Custom tray menu items

You can customize these tray menus and add your own option for your convenience. To add a menu contribution to an individual server, add the following to your server.json:
1
{
2
"trayOptions":[
3
{
4
"label":"Foo",
5
"action":"openbrowser",
6
"url":"http://${Setting: runwar.host not found}:${Setting: runwar.port not found}/foobar.cfm",
7
"disabled":false,
8
"image":"/path/to/image.png"
9
}
10
]
11
}
Copied!

Tray menu makeover

We've updated to a new library that creates the tray icon for your running servers and the menu that appears when you right click. In addition to better support for some Linux distros, we've added some nice new icons to the menus.

Pre/Post package scripts

Before any package script is run, CommandBox will look for another package script with the same name, but prefixed with pre. After any package script is run, CommandBox will look for another package script with the same name, but prefixed with Post. So if you have a package that contains 3 package scripts: foo, preFoo, and postFoo, they will run in this order.
  1. 1.
    preFoo
  2. 2.
    foo
  3. 3.
    postFoo
This works for built-in package script names as well as as doc package scripts. It also works on any level. In the example above, if you created a 4th package script called prePreFoo, it would run prior to preFoo.

Better ForgeBox Login management

If you use more than one ForgeBox login, perhaps a personal one and a company one, it can be a pain to keep logging in. It's also hard to remember the last user you logged in with. We've introduced two new commands to help with this. Run this to tell you who you are logged in as:
1
forgebox whoami
Copied!
Run this to switch between users that you've previously logged in with:
1
forgebox use myUser
Copied!

onRelease interceptor/package script

We've added a new "onRelease" interceptor and package script to help with the workflow of publishing packages. Here's a run down of the three key points when bumping a package version.
  • preVersion - Announced before the new version is set using the bump command
  • postVersion - Announced after the new version using the bump command but before the Git repo is tagged.
  • onRelease - Announced after a new version is set using the bump command and after the Git repo is tagged.
Here is a typical package script work flow for working with a package that's hosted on GitHub and published to ForgeBox:
1
"scripts":{
2
"preVersion":"testbox run",
3
"postVersion":"package set location='gituser/repov#`package version`'",
4
"postPublish":"!git push --follow-tags"
5
}
Copied!
Then when you want to publish a new version of your package, commit your changes to Git and run the following commands:
1
bump --minor
2
publish
Copied!
Those two commands, in combination with your package scripts, would accomplish the following:
  1. 1.
    Run the package's test suite (a failure will abort the process)
  2. 2.
    Increase the minor version of the page
  3. 3.
    Tag the Git repo
  4. 4.
    Change the package's location property in box.json to point to the new tag
  5. 5.
    Commit the tag and new box.json
  6. 6.
    Publish the package to ForgeBox
  7. 7.
    Push the new box.json and Git tag

onInstall interceptor/package script

Announced while a package is being installed, after the package endpoint and installation directory has been resolved but before the actual installation occurs. This allows you to override things like the installation directory based on package type. Any values updated in the interceptData struct will override what the install command uses.

CLI Engine Update

The Lucee version that the CLI runs on has been updated to be 4.5.3.020 which is also now the default engine to be used when you use the "server start" command and don't specify a cfengine. If you still want to start a web server on Lucee 4.5.2.018, then simply to this:
1
start cfengine=[email protected]+018
Copied!

Release Notes

There are tons of little bug fixes in this version that you can view in our release notes.

Bug

  • [COMMANDBOX-187] - error when updating forgebox when slugname changes
  • [COMMANDBOX-422] - Empty command CFCs with no functions throw an error starting box
  • [COMMANDBOX-423] - Error "key [FUNCTIONS] doesn't exist" thrown when trying to start command box
  • [COMMANDBOX-426] - server name completion errors on server open command
  • [COMMANDBOX-434] - Document the resolvePath() differing behaviour on OSX vs Windows
  • [COMMANDBOX-435] - artifacts clean fails on OSX when there's .DS_Store files
  • [COMMANDBOX-437] - appSkeleton in the coldbox create app wizard needs to comply to IDs instead of local disk
  • [COMMANDBOX-449] - "server open" always opens localhost
  • [COMMANDBOX-451] - The trayicon in server.json does not work with relative paths
  • [COMMANDBOX-464] - update command doesn't respect original install path
  • [COMMANDBOX-465] - custom url rewrite location doesn't respect starting server by name in different location
  • [COMMANDBOX-466] - coldbox create crud doesn't work on Windows

New Feature

  • [COMMANDBOX-316] - Add Fusion Reactor support for server
  • [COMMANDBOX-399] - Starting server in web root with WEB-INF treats CWD as war
  • [COMMANDBOX-416] - Add "open" flag to touch/new command.
  • [COMMANDBOX-430] - forgebox whoami command to show what user your API key is set to
  • [COMMANDBOX-431] - Update the storage of the APIkey in the commandbox settings to include multiple keys
  • [COMMANDBOX-432] - Have a forgebox use {username} command to switch the current api key
  • [COMMANDBOX-445] - Allow aliases (virtual directory) in web server
  • [COMMANDBOX-458] - Provide custom 40x and 50x error pages for servers

Improvement