Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Intro To CommandBox CLI,Package Manager, Server at the Japan CFUG

24 views

Published on

A presentation on the basics of CommandBox to the Japan ColdFusion User Group.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Intro To CommandBox CLI,Package Manager, Server at the Japan CFUG

  1. 1. Go Commando!
  2. 2. WHO AM I? • Luis Majano • Computer Engineer • Born in El Salvador ->Texas • CEO of Ortus Solutions • Adobe Community Professional • ColdFusion (CFML) Advocate • Adobe Advisory Committee • Lucee Language Committee • Sandals -> ESRI -> Ortus @lmajano @ortussolutions
  3. 3. How do we work in CF A better way to work in CF What is CommandBox Features Demo Making CFML Huuugeee Again!
  4. 4. HOW DO WE WORK IN CF? Code% App% Code Code Code Code Code Code Code
  5. 5. IT’S ALIVE! Collaboration Automation Reusability
  6. 6. CFMLTOOLING
  7. 7. CFML SHAMING • Lack of tooling • Package Management • CLI • OS Integrations • Applications • Legacy Hell • Way behind the cool kids
  8. 8. LEGACY PROBLEM • Gives CFML a bad name • Security Issues • Performance Issues • Employee Issues • Development Issues • Finding Developer Issues • >35% No MVC • >60% No DI • >55% NoTesting
  9. 9. How we should work! App#Package# Manager# CLI# REPL# Automa6on# OS#
  10. 10. Take CFML Back to The Future
  11. 11. Since 2015 Package Manager, REPL, CLI + More
  12. 12. What is CommandBox? CLI Package
 Manager REPL Read-Eval
 Print-Loop Integrated
 Server Scaffolding CFML ColdFusion AutomationForgeBox
  13. 13. Who is this for? Any ColdFusion (CFML) Developer
  14. 14. Free 4 All Java 8+ v4.2.0
  15. 15. Professional Open Source • GitHub • https://github.com/Ortus-Solutions/commandbox • Services • On-SiteTraining • VirtualTraining • Mentoring • Custom Development • Security Services • Support
  16. 16. What is CommandBox? CLI Package
 Manager REPL Read-Eval
 Print-Loop Integrated
 Server Scaffolding CFML ColdFusion AutomationForgeBox
  17. 17. Usage - CLI vs Shell box myapp.cfm Shell
  18. 18. Usage - OS Execution OS 
 +
 CFML Execute CFML Files box myapp.cfm & Box Scripting: *Unix #!/usr/bin/env box
  19. 19. Usage - Commands • How you get things done! • Built-in Help • command help • Command Namespaces • Commands • Aliases • Parameters/Arguments • Tab-Completion • History
  20. 20. Usage - Parameters Named Params box execute file=test.cfm Positional box install coldbox Boolean Flags box coldbox create app —installColdBox Boolean Flags box coldbox create controller —!script Escape Input t,n, ”, ’
  21. 21. Usage - History Command History box history REPL History box history type=scriptrepl box history type=tagrepl Clear History box history —clear
  22. 22. Usage - OS Integration • Editing • sed • Output Manipulation • |, more, tail, grep • File Redirection • > Create, >> Append • Open • Files/Directories • Browser • Run OS Binaries • Grunt, Node, Git, Gulp, Etc.
  23. 23. What is CommandBox? CLI Package
 Manager REPL Read-Eval
 Print-Loop Integrated
 Server Scaffolding CFML ColdFusion AutomationForgeBox
  24. 24. What’s a package? • A folder or zip/tar file that must contain: • box.json • It must be in the root! init name="My Package" version="1.0.0"
  25. 25. Were do packages run? CFML 
 App $ CLI
  26. 26. box.json • Package Descriptor • Declares package metadata • Name • Slug • Version • Author • Dependencies • DevDependencies • Installation Details • Custom Metadata • Package Scripts • Listen to CLI/Server/OS Events
  27. 27. BOX.JSON{ "name":"cbdebugger Builder", "version":"1.5.0", "slug":"cbdebugger-shell", "dependencies":{ "coldbox":"^4.3.0", "workbench":"git+https://github.com/Ortus-Solutions/unified-workbench.git" }, "devDependencies":{ "testbox":"2.3.0+00044" }, "installPaths":{ "testbox":"testbox", "coldbox":"coldbox", "workbench":"workbench" }, "testbox":{ "runner":"http://localhost:49616" }, "scripts":{ "postVersion":"recipe workbench/bump.boxr" } }
  28. 28. Working With Packages $ package help
  29. 29. Where do they come from? • ForgeBox • File zip/tar • Directory • Git • Github • Bitbucket • HTTP/S • JAR Code Endpoints install coldbox@4.3.0 install coldbox@be install http://www.site.com/myPackage.zip install https://maven/myjar.jar install /var/libs/myPackage.zip install /var/libs/myPackage/ install username/repoName.git#v1.5.6
  30. 30. Packaging Features • Can distribute without dependencies • Can have development dependencies • Dependencies Inception • “install” to initialize a project • “update” to update dependencies • “outdated” to check for versions • “list” to visualize dependencies • “uninstall” to uninstall dependencies
  31. 31. Package Scripts • Interceptor-based CLI Scripts • Listen to CommandBox Events • Supports Expansions, CFML functions, piping, environment variables, etc. "scripts" : { "postVersion" : "package set location='gitUser/gitRepo#v`package version`'", "postPublish" : "!git push --follow-tags" } • Ad-hoc Scripts as well "scripts" : { "build" : "!grunt build && testbox run && run-script generateAPIDocs && bump --patch && publish", "generateAPIDocs" : "docbox generate" }
  32. 32. What is CommandBox? CLI Package
 Manager REPL Read-Eval
 Print-Loop Integrated
 Server Scaffolding CFML ColdFusion AutomationForgeBox
  33. 33. Read - Eval - Print - Loop • Executes code • SupportTags or CFScript • History • Multi-line Statements • Declare closures, functions, etc • Keeps variables state • Developer’s best friend REPL
  34. 34. What is CommandBox? CLI Package
 Manager REPL Read-Eval
 Print-Loop Integrated
 Server Scaffolding CFML ColdFusion AutomationForgeBox
  35. 35. Integrated Server • Lightweight servlet container: undertow • Startup ad-hoc servers in any folder • Keeps track of servers, no WEB-INF needed • Server Commands • start • stop • restart • status • log • open • forget • Lucee + Adobe CF + Any Java WAR
  36. 36. CFML Engine PORTABILITY CONTAINERS https://commandbox.ortusbooks.com/content/deploying-commandbox/docker.html
  37. 37. What is CommandBox? CLI Package
 Manager REPL Read-Eval
 Print-Loop Integrated
 Server Scaffolding CFML ColdFusion AutomationForgeBox
  38. 38. What is ForgeBox • https://forgebox.io • ColdFusion (CFML) Code Directory • Foster Community • Works in Unison with CommandBox • Cloud Package Management • 500+ Packages and growing
  39. 39. ForgeBox Registration • CLI or UI • Ask you a few questions • Ready to start publishing • Registers an API Key for you forgebox register https://forgebox.io/security/registration
  40. 40. ForgeBox Commands $ forgebox help
  41. 41. ForgeBox Identities • Login from CLI • forgebox login • Stores your API Key • ~user./CommandBox • Supports multiple logins • forgebox use username • Supports Who you are • forgebox whoami
  42. 42. ForgeBox Publish • Publishes your public/private packages • Reads your box.json • Can push your readme files, changelogs, instructions • Make sure location key is set forgebox publish
  43. 43. PRO ACCOUNTS • Monthly Subscription Service • Private Packages • S3 Storage • Unique Installation Strings • FREE for limited time
  44. 44. What is CommandBox? CLI Package
 Manager REPL Read-Eval
 Print-Loop Integrated
 Server Scaffolding CFML ColdFusion AutomationForgeBox
  45. 45. ColdFusion Extensibility • Commands are all CFML • Create custom commands and modules • Register in ForgeBox • Favorite Commands • commandBox-Chuck-Norris • commandbox-docbox • commandbox-fusionreactor • commandbox-cflint CFML
  46. 46. What is CommandBox? CLI Package
 Manager REPL Read-Eval
 Print-Loop Integrated
 Server Scaffolding CFML ColdFusion AutomationForgeBox
  47. 47. Automation Commands • execute • Executes cfml scripts like batch files • Can accept parameters • Task Runners • Analagous to gulp, ant, gradle, etc • CFC with execution targets • Recipes • Like a “Batch” file: !#/usr/bin/box • Runs multiple commands • Can accept parameters • my-recipe.boxr
  48. 48. build.cfc Task run build task run build createZips task run build compileAssets task run build minimzeJS component { function run() { createZips(); compileAssets(); } function createZips() { print.line( 'Zips created!' ); } function compileAssets(){ print.line( 'Assets Compiled!' ); } function minimizeJS(){ print.line( 'JS Minimized!' ); } }
  49. 49. # Init a repository mkdir $name init $name run git init # Create ColdBox App coldbox create app $name —installColdBox coldbox create handler $controller index,save,delete coldbox create module $module # Prepare for Testing install testbox package set defaultPort=“$port” package set testbox.runner=“localhost:$port/tests/runner” my-recipe.boxr recipe my-recipe.boxr MyApp
  50. 50. What is CommandBox? CLI Package
 Manager REP L Read-Eval
 Print-Loop Integrated
 Server Scaffolding CFM L ColdFusion AutomationForgeBox
  51. 51. Scaffolding Available For Any Framework or Application Preside CMS
  52. 52. Scaffolding init coldbox create app “MyApp” —-installColdBox coldbox create handler contacts index,save,delete coldbox create module MyModule install testbox package set defaultPort=“90001” package set testbox.runner=“localhost:90001/tests/runner” testbox run
  53. 53. Resources • Official Site • https://ortussolutions.com/products/commandbox • Documentation + Book • https://apidocs.ortussolutions.com/commandbox/current • https://commandbox.ortusbooks.com • Google Group • https://groups.google.com/a/ortussolutions.com/forum/#!forum/commandbox • Training • https://ortussolutions.com/services/training • Professional Support • https://ortussolutions.com/services/support @lmajano @ortussolutions
  54. 54. ENTERPRISE • ForgeBox for Enterprise + Government • Downloadable Appliance • Encapsulated Dependencies • Unique URI entrypoint • Unique CommandBox Registrations forgebox register ortus http://fb.ortus.com install ortus:cfbox install ortus:@lmajano/cfbox
  55. 55. Q & A

×