create db dir if not exist

This commit is contained in:
oleg 2015-11-22 10:55:44 +03:00
parent 20347e9005
commit da88eec40d

15
app.js
View File

@ -143,13 +143,12 @@ Steppy(
// path to root dir (with projects, builds etc) // path to root dir (with projects, builds etc)
app.config.paths.data = path.join(process.cwd(), 'data'); app.config.paths.data = path.join(process.cwd(), 'data');
app.config.paths.projects = path.join(app.config.paths.data, 'projects'); app.config.paths.projects = path.join(app.config.paths.data, 'projects');
app.config.paths.builds = path.join(app.config.paths.data, 'builds');
app.config.paths.db = path.join(app.config.paths.data, 'db'); app.config.paths.db = path.join(app.config.paths.data, 'db');
app.config.paths.preload = path.join(app.config.paths.data, 'preload.json'); app.config.paths.preload = path.join(app.config.paths.data, 'preload.json');
var buildDirExistsCallback = this.slot(); var dbDirExistsCallback = this.slot();
fs.exists(app.config.paths.builds, function(isExists) { fs.exists(app.config.paths.db, function(isExists) {
buildDirExistsCallback(null, isExists); dbDirExistsCallback(null, isExists);
}); });
var preloadExistsCallback = this.slot(); var preloadExistsCallback = this.slot();
@ -157,11 +156,11 @@ Steppy(
preloadExistsCallback(null, isExists); preloadExistsCallback(null, isExists);
}); });
}, },
function(err, isBuildsDirExists, isPreloadExists) { function(err, isDbDirExists, isPreloadExists) {
if (!isBuildsDirExists) { if (isDbDirExists) {
fs.mkdir(app.config.paths.builds, this.slot());
} else {
this.pass(null); this.pass(null);
} else {
fs.mkdir(app.config.paths.db, this.slot());
} }
if (isPreloadExists) { if (isPreloadExists) {