lib/api.js
function(user, identifier, containerIdentifier, revision, target, out, cb) {
    var containerDef;
    var systemId;

    systemId = _sr.findSystem(identifier);
    if (!systemId) {
      logger.error(ERR_NOSYSID); return cb(new Error(ERR_NOSYSID));
    }
    var systemRoot = _sr.repoPath(systemId);
    out.initProgress(9, '--> finding container');

    fetchTarget(systemId, target, revision, function(err, target) {
      if (err) { return cb(err); }
        _builder.loadMatchingTargets(systemId, revision, target, function(err, targets) {
          if (err) { return cb(err); }
          _builder.findContainer(systemId, revision, targets, containerIdentifier, function(err, containerDefId, targets) {
            if (err) { out.stdout(err); logger.error(err); return cb(err); }
            if (!containerDefId) { out.stdout(ERR_NOCDEF); logger.error(ERR_NOCDEF); return cb(ERR_NOCDEF); }
            async.eachSeries(_.values(targets), function(json, cb) {
              var root = buildSys(json);
              containerDef = root.containerDefByDefId(containerDefId);
              json.repoPath = systemRoot;

              if (!containerDef.specific || !containerDef.specific.repositoryUrl) {
                return _builder.build(user, systemId, targets, json, containerDef, target, out, cb);
              }

              _synchrotron.synch(json, containerDef, out, function(err) {
                if (err) { out.stdout(err); logger.error(err); return cb(err); }
                _builder.build(user, systemId, targets, json, containerDef, target, out, cb);
              });
            }, cb);
        });
      });
    });
  }
function(user, identifier, containerIdentifier, revision, target, out, cb) {
    var containerDef;
    var systemId;

    systemId = _sr.findSystem(identifier);
    if (!systemId) {
      logger.error(ERR_NOSYSID); return cb(new Error(ERR_NOSYSID));
    }
    var systemRoot = _sr.repoPath(systemId);
    out.initProgress(9, '--> finding container');

    fetchTarget(systemId, target, revision, function(err, target) {
      if (err) { return cb(err); }
        _builder.loadMatchingTargets(systemId, revision, target, function(err, targets) {
          if (err) { return cb(err); }
          _builder.findContainer(systemId, revision, targets, containerIdentifier, function(err, containerDefId, targets) {
            if (err) { out.stdout(err); logger.error(err); return cb(err); }
            if (!containerDefId) { out.stdout(ERR_NOCDEF); logger.error(ERR_NOCDEF); return cb(ERR_NOCDEF); }
            async.eachSeries(_.values(targets), function(json, cb) {
              var root = buildSys(json);
              containerDef = root.containerDefByDefId(containerDefId);
              json.repoPath = systemRoot;

              if (!containerDef.specific || !containerDef.specific.repositoryUrl) {
                return _builder.build(user, systemId, targets, json, containerDef, target, out, cb);
              }

              _synchrotron.synch(json, containerDef, out, function(err) {
                if (err) { out.stdout(err); logger.error(err); return cb(err); }
                _builder.build(user, systemId, targets, json, containerDef, target, out, cb);
              });
            }, cb);
        });
      });
    });
  }
function ( user , identifier , containerIdentifier , revision , target , out , cb ) { var containerDef ; var systemId ; systemId = _sr . findSystem ( identifier ) ; if ( ! systemId ) { logger . error ( ERR_NOSYSID ) ; return cb ( new Error ( ERR_NOSYSID ) ) ; } var systemRoot = _sr . repoPath ( systemId ) ; out . initProgress ( 9 , '--> finding container' ) ; fetchTarget ( systemId , target , revision , function ( err , target ) { if ( err ) { return cb ( err ) ; } _builder . loadMatchingTargets ( systemId , revision , target , function ( err , targets ) { if ( err ) { return cb ( err ) ; } _builder . findContainer ( systemId , revision , targets , containerIdentifier , function ( err , containerDefId , targets ) { if ( err ) { out . stdout ( err ) ; logger . error ( err ) ; return cb ( err ) ; } if ( ! containerDefId ) { out . stdout ( ERR_NOCDEF ) ; logger . error ( ERR_NOCDEF ) ; return cb ( ERR_NOCDEF ) ; } async . eachSeries ( _ . values ( targets ) , function ( json , cb ) { var root = buildSys ( json ) ; containerDef = root . containerDefByDefId ( containerDefId ) ; json . repoPath = systemRoot ; if ( ! containerDef . specific || ! containerDef . specific . repositoryUrl ) { return _builder . build ( user , systemId , targets , json , containerDef , target , out , cb ) ; } _synchrotron . synch ( json , containerDef , out , function ( err ) { if ( err ) { out . stdout ( err ) ; logger . error ( err ) ; return cb ( err ) ; } _builder . build ( user , systemId , targets , json , containerDef , target , out , cb ) ; } ) ; } , cb ) ; } ) ; } ) ; } ) ; }
build a container
build a container