# Getting started with Cobalt

## Software requirements

1. Firstly, you need to install LTS version of Node.js platform from [official site](http://nodejs.org/).

2. Then you should install [Git](http://git-scm.com/).

## Installing Cobalt CLI

After installing Node.js you will be able to use NPM (Node Package Manager). Install Cobalt CLI using NPM:

	npm install -g cobalt-cli

## Get help

To get Cobalt CLI help type the command below

    co --help

Or run specific command with -h option, e.g:

    co init -h

## Version

Use command below to get Cobalt CLI version:

    co --version

or shorthand:

    co -V

## Authorize

Enter command below to authorize:

	co login

Enter your email address and press Enter:

	Ewizard instance: https://instance-name@ewizard.io

You will be redirected to default browser to enter your credentials for login.

After all these steps you will see the successful login message:

	Successfully logged in!

## Deauthorize

Enter command below to deauthorize:

	co logout

Successful logout message should appear:

	Successfully logged out!

## Generators

Use built-in generator to create initial presentation structure and install all dependencies:

	co init


After successful presentation creation, you will be able to use other Cobalt CLI commands.

Create new slide:

	co slide %slide-id%


Create a new slide with the CSS-file included

	co slide %slide-id% --css


Create chapter:

	co chapter


Create data controller:

	co controller %controller-name%


## Modules

`co module` command is used to fetch and install modules and project dependencies. It is using NPM mechanisms inside.

Execute the command below to install the module (jQuery for example):

	co module install --save jquery

`--save` flag is optional and used for saving current component as a dependency into package.json manifest.

Use `cobalt/` prefix to install Cobalt module:

	co module install --save cobalt/%module-name%


## Build

### Develop build

Execute the command below to build the project:

	co debug

If you don't want to build your project manually every time there is a change, use command above with `--watch` option. It will force Cobalt CLI to watch all your files and build the project automatically.

	co debug --watch


If you want to run your project using local web server, you should execute the command above with `--live` parameter. Local server will be created and your project will be available at the address `127.0.0.1:8000`. After making changes in presentation source files, the engine will rebuild the project automatically.

	co debug --live


### Prodcution build

Execute the command below to run the remote build:

	co export --clm %CLM-platform-name%

This command will compress your project and send it to the server to build it for specified CLM-platform.


#### --clm

`--clm` parameter is required. This option specifies one of the available CLM platforms (mitouch, irep, iplanner, abbott, viseven, e.t.c).

Also, there are few optional parameters.

#### --slides

`--slides` parameter is used to specify the list of slides to build:

	co build --clm %CLM-platform-name% --slides "%slide id% %slide id1% %slide idN%"

All slides are built by default.


#### --structure

`--structure` parameter is used to specify the JSON-file, which contains presentation structure to build:

	co build --clm %CLM-platform-name% --structure %file-path%

File path is relative to the presentation root. There is no need to specify the file extension.

In case you need some detailed information, please, visit our documentation site: https://docs.cobalt-engine.com/
