ce-util

3.0.7 • Public • Published

The Doctor | Cloud Elements Asset Management Tool


Version Downloads

Overview

The Doctor is a CLI tool to allow easy control management with Cloud Elements. This provides the ability to move between environments and to backup files locally or to GitHub.

Installation

$ npm install -g ce-util

PROTIP: node version must be >= v6.3.0

Setup

$ doctor init

The init function will create a hidden directory .doctor in your home directory. This folder will have a config.json that will store all your accounts.

An account consists of a name, orgSecret, userSecret and baseUrl. Make sure the baseUrl is formatted like: https://staging.cloud-elements.com, https://console.cloud-elements.com, or https://console.cloud-elements.co.uk

Usage

The doctor can download/upload assents from your Cloud Elements accounts to a directory or to a file.

GitHub

For use with GitHub, it is recommended to use the --directory option. This will export assets to an intuitive directory structure, and extract any JavaScript to its own file.

Versioning

Versioning in the doctor can be used to manage VDRs or Formulas in github using the -v flag. It allows deploying an updated versioned object to an environment without affecting the current deployed version. For upload the version is applied by appending "_{version}" to the name of the object being uploaded. For downloads the version will split on a "_" delimiter. Example download result "myFormulaName_v2" saves as "myFormulaName". Versioning currently only supports downloading of single objects using the -n

Continuous Deployment

For use with continuous deployment or just routine backups its recommended to just use the --file option. This will save space complexity as an entire CE environment can be represented as one file.

Commands

download    save objects locally
upload      imports objects into your account
delete      delete objects from your account
graph       graph a formula flowchart
accounts    manage accounts to use
init        initialize account
help [cmd]  display help for [cmd]

Objects

all
elements
formulas
vdrs
formulasInstances (delete only)
instances (delete only)

Options

-d, --directory for downloading/uploading to/from and directory
-f, --file for downloading/uplaoding to/from and file
-n, --name for downloading/uploading a specific entity or multiple comma-separated entities to/from and directory/file
-v, --version for downloading/uploading versioned objects

Examples

# list all accounts you have available to interact with
$ doctor accounts list

# removes an account from the list of accounts by the given account nickname or -n
$ doctor accounts remove -n devStaging

# add an account in one line
$ doctor accounts add -n devStaging -u <user secret> -o <organization secret> -b https://staging.cloud-elements.com

# import vdrs from a specified file path to an account (via nickname from your account list) Note: you can replace vdrs with formulas, elements, or all)
$ doctor upload vdrs staging -f ~/Desktop/vdrs-staging.json

# export vdrs from a specified account (note the account should be from your accounts list and you just need to denote the account name) to the given file path. Again: you can replace vdrs with formulas, elements, or all)
$ doctor download vdrs staging -f ~/Desktop/vdrs-staging.json

# export an vdr from the list of specified account vdrs to the given folder path. For elements, you need to pass element key using -n. Again: you can replace vdrs with formulas, elements
$ doctor download vdrs staging -n myVdr -D ~/Desktop/vdrs/

# export vdrs (comma-separated) from the list of specified account vdrs to the given folder path. For elements, you need to pass element key using -n. Again: you can replace vdrs with formulas, elements
$ doctor download vdrs staging -n vdr1,vdr2,vdr3 -D ~/Desktop/vdrs/

# export vdrs from specified account vdrs to the given folder path. (Note: use -u or --useNew boolean flag to download vdrs in new folder structure for more readability)
$ doctor download vdrs staging -D ~/Desktop/vdrs/ --useNew

# import an vdr from the list of specified account vdrs. For elements, you need to pass element key using -n. Again: you can replace vdrs with formulas, elements
$ doctor upload vdrs staging -n myVdr -D ~/Desktop/vdrs/

# import vdrs (comma-separated) from the list of specified account vdrs. For elements, you need to pass element key using -n. Again: you can replace vdrs with formulas, elements
$ doctor upload vdrs staging -n vdr1,vdr2,vdr3 -D ~/Desktop/vdrs/

# doctor delete has similar functionality but will not allow you to delete all. Please see doctor delete --help for more
$ doctor delete formulas accountName 

# export formulas separating out JS into files for easier version control
$ doctor download formulas staging -d ~/Desktop/formulas

# import or export specific entities by their name using -n, --name (You can pass list of comma-separated names)
$ doctor upload formulas staging -d ~/formulas -n specific\ formula\ name

# export a versioned object (example formula named myFormula_2)
$ doctor download formulas staging -f ~/formula.json -n myFormula -v 2

# import a versioned object (example formula named myFormula, version 3)
$ doctor upload formulas staging -f ~/formula.json -v 3

# generate flow chart for the specified formula
$ doctor graph formulas -f ~/Desktop/doctor/formula.json

Limitations

The doctor can not export instance or account level entities i.e. instances, instance or account level object definitions/transformations, accounts, users and formula instances.

Versioning is not supported for elements

Setup Local Development Environment

$ npm uninstall ce-util -g 
$ git clone https://github.com/CloudElementsOpenLabs/the-doctor.git
$ cd the-doctor
$ npm install -g
$ npm link 

Readme

Keywords

none

Package Sidebar

Install

npm i ce-util

Weekly Downloads

6

Version

3.0.7

License

ISC

Unpacked Size

143 kB

Total Files

91

Last publish

Collaborators

  • ramana4029
  • mohdrafi188
  • mukundce
  • girinellore
  • mjhirsch
  • nick.bair