In today's world, we use frameworks, and separate concerns with MVC or MV*, we strive for Clean Code to make Uncle Bob proud, or Bossman Bob at least. Just because the “Run” function is all you need in a CFC (which extends the BaseCommand) for CommandBox to index the Command, doesn’t mean you have to jam all your code into that one function. Lets look at some simple code cleanup.
As I always say, "All work and no fun makes you a dull programmer!" Well, with CommandBox, we're here to fight boredom and productivity with the fun "Snake" game. This is the class game of moving an-ever growing snake around the map in 4 directions while eating up the apples. For every app the snake devours, it grows by one character in length.
One exciting feature about CommandBox is the ability to group commands together into a lovingly little file we call, a recipe. We even gave it its own extension, .boxr. This little gem will allow you to automate several commands from your native shell, it will be faster to use our recipe command that allows you to run several CommandBox commands at once. This will allow you to only load the CommandBox engine once for all those commands, but still be dumped back at your native prompt when done. Recipes can also just be useful for a series of commands you run on a regular basis, from test executions, to compressing files, the possibilities are endless.
Below is a simple example of how to create a recipe and execute it. For further insight, we recommend you read our chapter on recipes in our CommandBox book.
Let's keep that around
One of the neat "under the hood" features of CommandBox is artifacts. Artifacts are a copy of each package that gets downloaded with CommandBox. This is good for you and for the internet because once you have a package in your artifacts, you don't need to download it again. Artifacts are key to CommandBox efficiency.
We might need that again
The next time you download a package from ForgeBox, CommandBox reads the box.json file for that package's dependencies. Then, it checks to see if we already have a copy of those dependencies in the artifacts. If the dependency is in the artifacts, CommandBox just uses it. If not, then CommandBox calls to ForgeBox to get that dependency. That's efficiency.
Ever want to try something quick in CFML? Show something off and get the feedback instantly?
One of the things CommandBox can do for you is provide a REPL (Read-Evaluate-Print-Loop) console for immediate ColdFusion (CFML) interaction so you can do just that.
After CommandBox is installed, just run
Using a command line tool, like CommandBox, you look for those feature comforts, that can make or break the UI. With CommandBox, one of the big wins, is HELP. Most command line tools allow you to type help and get some general help, but CommandBox goes a step further, you can get Help the Global Level, Namespace Help, and even help at the Command Level.
We have big plans for using CommandBox to install packages from all sorts of code endpoints-- local folders, Git/SVN URLs, private corporate repos, etc. Version 1.0 of CommandBox focused on ForgeBox though, which is our CFML code depot. It may have started out as a ColdBox/ContentBox-specific thing, but is now open to the entire community to put any project they want on. I'm excited to already see entries like CFWheels, FW/1, MXUnit, and MonkehTweets on there. The more packages installable from CommandBox via ForgeBox, the more we all win.
Soon ForgeBox will get even more life of its own enhancing it with more functionality such as having multiple versions of the same package. We've already set up forgebox.io as the new domain for ForgeBox's HTML interface where you can search, sort, and filter the entries in your web browser. We've also built a "forgebox" namespace into CommandBox that uses the REST API to let you interact with ForgeBox from your console.
You may be wondering where all that amazing debugging information went in your ColdBox 4.0 application. Have no fear. You can still have your cake and eat it too. We modularized it (sensing a theme in ColdBox 4.0 yet?) So, how do you get all that wonderful debugging info?
Easy! Using CommandBox, run the following command.
After almost a year in development, we are so excited to finally announce the release of CommandBox 1.0.0 Final. This has been definitely one of the most challenging and fun projects we have overtaken here at Ortus. We had a vision of how we could accelerate not only development, tools and ultimately the ColdFusion (CFML) landscape by building a tool that could put us up to par with many other technologies. I am glad to say we have now a great foundation to move forward. CommandBox brings CFML to any Operating System and even embedded systems like the Raspberry and Banana Pi. It also gives ColdFusion (CFML) developers a much better workflow to work with their projects and a sense of community we lovingly call ForgeBox.
With anything we do here at Ortus, it is fully documented using our new book formats. So head on over to commandbox.ortusbooks.com to download or read the entire CommandBox documentation. In the next coming weeks we will begin our CommandBox 5 week roadshow that will include weekly blogging tutorials and video presentations, so stay tuned as each week progresses. So without further ado, I present to you project Gideon: CommandBox CLI!