cb-cli init - Initializes a ClearBlade system locally
cb-cli init [-url = <URL>] [-system-key = <SYSTEM_KEY>] [-email = <DEVELOPER_EMAIL>] [-password = <PASSWORD>]
The init command is the first command to be run when wanting to work on a ClearBlade system locally. It has four options which can be specified on the command line or entered at prompts given by the command. These options are:
The full url of the ClearBlade platform eg: https://platform.clearblade.com
The system key for the system being brought local
The messaging url for the system being brought local
The email address of the developer working on the system (you)
Your password for the ClearBlade platform system
You can specify all, some, or none of these options on the command line itself. For those that you didn’t specify, The system will prompt you for the values.
On successful completion of this command a skeleton tree structure is created under your current working directory, with the root of the tree named after the ClearBlade system you just init-ed. Note that if the system name had spaces, they are converted to underscores. Inside the root directory of the system, two special files are created:
.cbmeta This holds information specific to the developer. It is used to streamline authentication so that you don’t have to enter emails, passwords, and tokens for all future commands.
system.json This contains information specific to the system you’re working on (system name, system key, etc.)
The directory structure for a system looks like this (for a system named “Outstanding System”):
Outstanding_System/ |- .cbmeta |- system.json |- code/ |- libraries/ |- services/ |- data/ |- roles/ |- timers/ |- triggers/ |- users/
Once you’ve successfully executed the init command, you should cd into and live in the repo when running all future commands. The behavior is similar to the git command in that you can run any of the other cb-cli commands from anywhere in the repo.
Integration with SCM
An example of using the init command from inside an existing repo is as follows. Suppose multiple developers are working on the same system and you’re using git as a repository for the repo. In this case you would do a git clone go grab the repo. You’d then cd into the repo and run cb-cli init. This would set up the .cbmeta file to contain your credentials.
If you’re using cb-cli in concert with git, in the .gitignore file for the repo. add .cbmeta. This way, when anybody clones/pulls the repo from git, they’ll have to use the init command to associate their credentials with the associated platform.