lib/api.js
function(user, identifier, revisionIdentifier, target, mode, out, cb) {
    var systemId = _sr.findSystem(identifier);

    if (!systemId) { logger.error(ERR_NOSYSID); return cb(new Error(ERR_NOSYSID)); }

    fetchTarget(systemId, target, revisionIdentifier, function(err, target) {
      if (err) { return cb(err); }

      _sr.findRevision(systemId, revisionIdentifier, function(err, revisionId) {
        if (err) { out.stdout(ERR_NOREV); logger.error(ERR_NOREV); return cb(ERR_NOREV); }

        logger.info({
          systemId: systemId,
          revisionId: revisionId,
          environment: target
        }, 'deploy revision');

        if (!mode) { mode = 'live'; }
        if (!revisionId) {
          return cb(new Error('revisionId is needed to deploy'));
        }
        return createAnalyzeAndDeployTask(user, systemId, revisionId, target, mode, out, cb);
      });
    });
  }
function(user, identifier, revisionIdentifier, target, mode, out, cb) {
    var systemId = _sr.findSystem(identifier);

    if (!systemId) { logger.error(ERR_NOSYSID); return cb(new Error(ERR_NOSYSID)); }

    fetchTarget(systemId, target, revisionIdentifier, function(err, target) {
      if (err) { return cb(err); }

      _sr.findRevision(systemId, revisionIdentifier, function(err, revisionId) {
        if (err) { out.stdout(ERR_NOREV); logger.error(ERR_NOREV); return cb(ERR_NOREV); }

        logger.info({
          systemId: systemId,
          revisionId: revisionId,
          environment: target
        }, 'deploy revision');

        if (!mode) { mode = 'live'; }
        if (!revisionId) {
          return cb(new Error('revisionId is needed to deploy'));
        }
        return createAnalyzeAndDeployTask(user, systemId, revisionId, target, mode, out, cb);
      });
    });
  }
deploy the specified revision to the nominated target
handle if file is missing