cb-cli

command module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2014 License: Apache-2.0 Imports: 11 Imported by: 0

README

cb-cli

The command line interface for interacting with the ClearBlade Platform.

This tool is currently in an alpha state and comes with no warantee. Please create issues for any problems you have, so we can continue to improve this tool.

Installation

Installation is easy and can be done two ways depending on whether or not you want to work with the source.

Source Installation

Installation from source requires that you have a Go toolchain all set up and ready to go. If you do not have Go installed but would like to do so, the instructions for doing this can be found here. After you have Go all set up, you can run the following command to install the cb-cli tool:

$ go get github.com/clearblade/cb-cli

This will pull the tool and all the dependencies and install everything. If you have your $GOPATH/bin on your $PATH then you should have cb-cli available in your shell where ever you are. If you do not then you will have to reference it by full path ($GOPATH/bin/cb-cli) or add that directory to your $PATH. To add this to your path run this:

$ echo 'export PATH="$PATH:$GOPATH/bin"' >> ~/.bashrc
$ source ~/.bashrc

This of course, will only work if you are using bash. If you are using an alternative shell, replave '.bashrc' in the line above with whatever the init file for your shell is.

Binary Installation

Installation from the binary distribution is quite simple. Go to the releases page and grab the lates release for your system. We currently only support OS X and Linux. Download the correct archive for your system, and unpack to the location in which you want the binary to be. Add this location to your $PATH with the following command:

$ echo 'export PATH="$PATH:/path/to/cb-cli/dir"' >> ~/.bashrc
$ source ~/.bashrc

This of course, will only work if you are using bash. If you are using an alternative shell, replave '.bashrc' in the line above with whatever the init file for your shell is. After this, you will have the cb-cli program anywhere in your shell.

Basic Usage

The tool currently has two sub-commands: 'pull' and 'push'. The first time you run the tool it will prompt you for your username and password. It will get an authentication token, and save it in ~/.cbauth. If you want to change the location of this auth file use the flag '-authinfo="/path/to/auth/file"'.

Pulling

A basic example of the pull sub-command is:

$ cb-cli pull aaaaaaaabbbbbbbbccccc111222333

Where aaaaaaaabbbbbbbbccccc111222333 is your systemKey. This will pull all of the services for that system and some meta data and it will put it in a directory named the same as the system name. The result of the example above:

$ cb-cli pull aaaaaaaabbbbbbbbccccc111222333
Code for aaaaaaaabbbbbbbbccccc111222333 has been successfully pulled and put in a directory testSystem
$ tree -a testSystem
testSystem/
├── .meta.json
├── testService2.js
└── testService.js

0 directories, 3 files

As you can see a directory named 'testSystem' has been created. There are three files in this directory. '.meta.json' is the first file. This file will exist in every system directory. It contains some things that cb-cli needs to make your life easier. Do not edit this file. The other two files are services that I had in my system. You can edit these services locally and then push them back to the server using the other sub-command 'push'.

Pushing

If your current working directory is a system directory (a directory that contains a '.meta.json' file and service files), you can push your local changes to the server using the following command:

$ cb-cli push
Push successful

If you have no changes locally, you will get the following error:

$ cb-cli push
Error pushing: No services have changed, nothing to push

If you are in the root directory of multiple systems, you will have to specify the systemKey of the system, you want to push:

$ cb-cli push aaaaaaaabbbbbbbbccccc111222333
Push successful

Todo

  • Create more tooling around local/server conflicts.
  • Expose more settings to the cb-cli (params, service creation)

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL