cloudelements-cmtool

An integrated client for CE CM apps.

npm install cloudelements-cmtool
12 downloads in the last week
80 downloads in the last month

Cloud Elements CMTool

This is the Cloud Elements CM tool, which is used to connect with and integrate the various CM applications used by Cloud Elements, such as Git and Pivotal Tracker.

Install (or update) it globally:

$ npm install -g cloudelements-cmtool
$ npm update -g cloudelements-cmtool

You may also need to set some environment variables: (you could put these in your ~/.bash_profile or other startup script)

$ export CMTOOL_GIT_DIR=/path/to/git/repo
$ export CMTOOL_PIVOTAL_TOKEN=mypivotaltoken12345abcde
$ export CMTOOL_DB_URL=postgres://user:pass@localhost:5432/dbname
$ export CMTOOL_CONFIG_HOME=/path/to/cmtool_home

Once these are sorted, you can use the cmtool from the command line:

$ cmtool <command> [parameters]

For example,

$ cmtool release-notes 1.10 1.11
$ cmtool qa-label "release-1.10" "qa environment"
$ cmtool get-props
$ cmtool put-props
$ cmtool one-shot uptime snap
$ cmtool delete-user ozchaz@gmail.com

Or, you can use it in your javascript code:

var cmtool = require('cloudelements-cmtool'),
    git = new cmtool.Git,
    pivotal = new cmtool.Pivotal('my-pivotal-token'),
    cart = new cmtool.Cart(pivotal, git);

process.chdir('path/to/git/repo');

cart.changeLog('1.10', '1.11', function(err, stories) {
  console.log("err", err);
  console.log("stories", stories);
});

git.log('patch-1.10.6', function(err, entry, done) {
  if (err != null) {
    console.log("err", err);
  } else if (done) {
    console.log("done");
  } else {
    console.log("found commit with hash", entry.hash);
  }
});

var cmdStep = cmtool.homie.cmdStep,
    task = {
  name: 'one-shot',
  usesConn: true,
  ccb: function(err) {
    if (err != null) {
      console.warn("Connection error: ", err);
    }
  },
  steps: [cmdStep('command', 'uptime')]
};
cmtool.homie.runTaskOn(task, 'all');

var dbUrl = 'postgres://user:pass@localhost:5432/dbname',
    dbtool = new cmtool.Dbtool(dbUrl),
    email = 'my.email@somewhere.com';

dbtool.deleteUser(email, function(err){
  if (err != null) {
    say("err: ", err);
  } else {
    say("Delete " + email + " complete");
  }
});
npm loves you