src/indexOld.js
function _createRepository() {
        return co(function*(){
            try {
                debug("Creating a new one");
                let repo = yield nodegit.Repository.init(repositoryPath, 0);
                debug("Connection established");
                debug("Creating main files");
                yield _createManifest(repo);
                yield _createConfig(repo);
                fs.mkdirSync(machinesDirPath);
                yield _commit(repo, ["manifest.json", "config.json"]);
                debug("Repository was successfully created");
                return repo;
            } catch (err) {
                debug(err);
                debug("Nuking the repository");
                yield new Promise(function(resolve, reject) {
                    rimraf(repositoryPath, function () {
                        resolve();
                    });
                }).then();
                throw new Error(err);
            }
        });
    }
function _createRepository() {
        return co(function*(){
            try {
                debug("Creating a new one");
                let repo = yield nodegit.Repository.init(repositoryPath, 0);
                debug("Connection established");
                debug("Creating main files");
                yield _createManifest(repo);
                yield _createConfig(repo);
                fs.mkdirSync(machinesDirPath);
                yield _commit(repo, ["manifest.json", "config.json"]);
                debug("Repository was successfully created");
                return repo;
            } catch (err) {
                debug(err);
                debug("Nuking the repository");
                yield new Promise(function(resolve, reject) {
                    rimraf(repositoryPath, function () {
                        resolve();
                    });
                }).then();
                throw new Error(err);
            }
        });
    }
function _createRepository ( ) { return co ( function * ( ) { try { debug ( "Creating a new one" ) ; let repo = yield nodegit . Repository . init ( repositoryPath , 0 ) ; debug ( "Connection established" ) ; debug ( "Creating main files" ) ; yield _createManifest ( repo ) ; yield _createConfig ( repo ) ; fs . mkdirSync ( machinesDirPath ) ; yield _commit ( repo , [ "manifest.json" , "config.json" ] ) ; debug ( "Repository was successfully created" ) ; return repo ; } catch ( err ) { debug ( err ) ; debug ( "Nuking the repository" ) ; yield new Promise ( function ( resolve , reject ) { rimraf ( repositoryPath , function ( ) { resolve ( ) ; } ) ; } ) . then ( ) ; throw new Error ( err ) ; } } ) ; }
Create a new repository
@method _createRepository
@returns {Promise} Repository connection
Create a new repository