Example

Step 1: Developer uses init to create initial directory structure

Command:

$ cb-cli init
- Platform URL :
- System Key :
- Developer Email :
- Password :

Result: A new directory will be created named your System Name. Inside there will be a single file called .cbmeta

-/<SYSTEM_NAME>
 |- .cbmeta

Step 2: Developer exports their system locally

This process will bring all the schema and asset definitions to your local environment

Command:

$ cd <SYSTEM_NAME>
$ cb-cli export

Result: Your folder should now be filled with a structure that looks like

-/<SYSTEM_NAME>
  |- .cbmeta
  |- system.json
  |- services
      |- helloworld.js
  |- libraries
  |- data
  |- roles
  |- users
  |- triggers
  |- timers

Step 3: Developer modifies a local service

This step represents a typical developer activity of making a modification to a service. For this task modify a service of your choice

function helloworld(req, resp){
    // COMMENT CHANGED!!!!
    resp.success("hello world: ");
}

Step 4: Developer views the differences

Action:

$ cb-cli diff -service=helloworld

Result:

the differences in your file will be listed

Step 5: Developer tests the new service

This is an optional step but often developers want to ensure that their changes work

Action:

$ cb-cli test -service=helloworld params="{'name':'Bill'}"

Result:

The latest service source code is uploaded to the system and then execute with the parameters passed in. The response will be similar to

NOTE: Testing a service will push your service to your system. This actvity should be done against a Test System

Step 6: Developer pushes their changes back to the ClearBlade system

Next if the developer has diffs that have not been tested and already sent the server they can now push those changes

NOTE: Now is a good time to commit your code to a source control repository!

Action:

cb-cli push -service=helloworld

Results:

Upon completion you will receive a list of all the files successully pushed up to the ClearBlade System

Step 7: Pulling the latest code

In a team environment you may want to pull latest changes that others have running on the system. You can accomplish this using - a source control branch - the asset running in the system

To get the asset running in the system locally use the pull command

Action:

cb-cli pull -service=anotherworld

Result: Your file system is now updated with the latest javascript in the anotherworld.js file.

Summary

The process for developing a local system continues with these above steps. Done correctly you should include a source control repository tool and best practice for back-up and change history purposes.

To learn more about the devops lifecycle the CLI also supports see the DevOps Example