# Developing with cob-cli

In a standard development workflow, you typically follow these steps:

  1. Implementing changes
  2. Conducting tests
  3. Deploying.

The cob-cli tool facilitates this process with the utilization of the following commands:

It's essential to note that both commands are effective only after initializing the server using the init command. This initialization ensures a seamless progression through modification, testing, and deployment phases in your development cycle.



# Testing w/ cob-cli test

Now that the CoB server has been initialized and the chosen customization has been installed, we can begin testing via cob-cli test. This deploys a local Webpack server accessible at https://localhost:8040.

UI changes in "recordm/customUI" are local only, while other modifications like IntegrationM scripts are copied to the server during testing and reverted when the local process stops.

Relevant flags:

cob-cli test [-d --dashboard <name>] [--localOnly]  [--servername <servername>] [--verbose] [--environment <env_name>] [--help]

For example, if the developer was working on a customization in /recordm/customUI/js/customizations named tickets.js, it will be served locally by the webpack server and won't be copied into the remote server.

> cob-cli test
Start testing…
Checking test conditions for learning.cultofbits.com
  βœ” Check connectivity and permissions
  βœ” Check there's no other 'cob-cli test' running locally
  βœ” find out branch-for-HEAD
  βœ” find out SHA for last-deploy on specified server
  βœ” git stash --include-untracked
  βœ” git checkout SHA for last-deploy
  βœ” Apply last enviroment specifics
  βœ” Check last-deploy == serverLive
  βœ” Undo last enviroment specifics
  βœ” git checkout branch-for-HEAD
  βœ” git stash pop

Checking changes...
 No changes found. ---> !!! No changes found in files OUTSIDE /recordm/customUI !!!

 NOTE: Press O to open default browser, CTRL+C or Q to stop the tests..

TIP

It is highly recommend that you take a look at the more detailed reference about the test command here (opens new window).


# Deploying modifications w/ cob-cli deploy

Once the developer is happy with the tested changes, he can deploy them into the server with cob-cli deploy. This command is used as the final stage of a typical cob-cli workflow.

If the developer's changes in ticket.js are ready for production, once he runs the deploy command, it will perform its consistency checks. If these checks pass, the deploy will be executed.

> cob-cli deploy
Checking conditions to deploy master to learning.cultofbits.com...
  βœ” Check connectivity and permissions
  βœ” Check git status
  βœ” Check there's no 'cob-cli test' running on server
  βœ” find out branch-for-HEAD
  βœ” find out SHA for last-deploy on specified server
  βœ” git checkout SHA-for-last-deploy
  βœ” Apply last enviroment specifics
  βœ” Check last-deploy == serverLive
  βœ” Undo last enviroment specifics
  βœ” git checkout branch-for-HEAD

Checking changes...

Changes that will be done in learning.cultofbits.com:
 change recordm/customUI/js/customizations/tickets.js

 Continue? [y/N]

cob-cli deploys warns the developer of new modifications before executing and deployment, and asks for confirmation. This permits the developer to double check the changes that are supposed to be deployed, to avoid unwanted modifications.

> yes
Deploying ...
  β ¦ Register release in DEPLOYLOG.md
    git push (branch: master)
  βœ” Register release in DEPLOYLOG.md
  βœ” git push (branch: master)
  βœ” Apply new enviroment specifics
  βœ” Deploy files to server's live directories
  βœ” Set last environment deployed
  βœ” Undo new enviroment specifics

Done!

WARNING

The test and deploy commands will run consistency checks to guarantee that no errors can occurr - such as to avoid overriding previous work. It is highly recommended that you check both of their detailed documentations, as well as the troubleshooting guide (opens new window).

# Installing Addons w/ cob-cli customize

cob-cli supports the installation of addons which we also call customizations. cob-cli customize offers an interactive menu for the installation of pre-existing addons. When running customize, the user is prompted with a list of available addons (customizations), which can be interactively chosen.

More details about the customize command here (opens new window).

> cob-cli customize
 
Customize...
? What customization do you want to apply? (Press <space> to select, <a> to toggle all, <i> to invert selection)
❯◯ customize.backend.governance
 β—― customize.backend.vuepress
 β—― customize.dashboard.dash
 β—― customize.dashboard.html_page_base
 β—― customize.dashboard.vue_base
 β—― customize.frontend.common
 β—― customize.frontend.style.currency
(Move up and down to reveal more choices)

After choosing the customize.dashboard.dash customization as an example:

  git pull https://github.com/cob/customize.dashboard.dash.git
  Applying customize.dashboard.dash customization ...
  Copying template files for customize.dashboard.dash...
  Done