lib/sysrev/sysrev.js
function(user, namespace, name, cwd, cb) {
    var repoName = name;
    var doc = _.extend({}, blank);
    var repoPath = path.join(cwd, repoName);

    doc.name = name;
    doc.namespace = namespace;
    doc.id = uuid.v4();

    if (!fse.existsSync(repoPath)) {
      fse.mkdirpSync(repoPath);
      initNscaleFiles(repoPath, doc, function() {
        git.createRepository(repoPath, user.name, user.email, function(err) {
          if (err) { return cb(err); }
          _meta.register(user, namespace, name, repoName, cwd + '/' + repoName, doc.id, function(err) {
            writeTimeline(user, doc.id, 'create', 'system created', function() {
              // swallow any errors here
              cb(err, {id: doc.id, err: err});
            });
          });
        });
      });
    }
    else {
      cb(null, { id: _meta.repoId(repoName), err: null});
    }
  }
function(user, namespace, name, cwd, cb) {
    var repoName = name;
    var doc = _.extend({}, blank);
    var repoPath = path.join(cwd, repoName);

    doc.name = name;
    doc.namespace = namespace;
    doc.id = uuid.v4();

    if (!fse.existsSync(repoPath)) {
      fse.mkdirpSync(repoPath);
      initNscaleFiles(repoPath, doc, function() {
        git.createRepository(repoPath, user.name, user.email, function(err) {
          if (err) { return cb(err); }
          _meta.register(user, namespace, name, repoName, cwd + '/' + repoName, doc.id, function(err) {
            writeTimeline(user, doc.id, 'create', 'system created', function() {
              // swallow any errors here
              cb(err, {id: doc.id, err: err});
            });
          });
        });
      });
    }
    else {
      cb(null, { id: _meta.repoId(repoName), err: null});
    }
  }
function ( user , namespace , name , cwd , cb ) { var repoName = name ; var doc = _ . extend ( { } , blank ) ; var repoPath = path . join ( cwd , repoName ) ; doc . name = name ; doc . namespace = namespace ; doc . id = uuid . v4 ( ) ; if ( ! fse . existsSync ( repoPath ) ) { fse . mkdirpSync ( repoPath ) ; initNscaleFiles ( repoPath , doc , function ( ) { git . createRepository ( repoPath , user . name , user . email , function ( err ) { if ( err ) { return cb ( err ) ; } _meta . register ( user , namespace , name , repoName , cwd + '/' + repoName , doc . id , function ( err ) { writeTimeline ( user , doc . id , 'create' , 'system created' , function ( ) { // swallow any errors here cb ( err , { id : doc . id , err : err } ) ; } ) ; } ) ; } ) ; } ) ; } else { cb ( null , { id : _meta . repoId ( repoName ) , err : null } ) ; } }
create a new system repository
create a new system repository