Run template engine and adapters during restart

This commit is contained in:
Aurélien Georget 2015-12-03 14:38:46 +01:00
parent 57b64f34fd
commit 08fd99b9ab
3 changed files with 15 additions and 11 deletions

View File

@ -54,9 +54,9 @@ module.exports = function (strapi) {
// Finally, use the middleware. // Finally, use the middleware.
strapi.app.use(strapi.middlewares.views(path.resolve(strapi.config.appPath, strapi.config.paths.views), strapi.config.views)); strapi.app.use(strapi.middlewares.views(path.resolve(strapi.config.appPath, strapi.config.paths.views), strapi.config.views));
cb();
} }
cb();
}, },
/** /**
@ -93,6 +93,7 @@ module.exports = function (strapi) {
process.exit(1); process.exit(1);
} }
strapi.log.info('`' + engine + '` successfully installed');
done(); done();
}); });
} else { } else {

View File

@ -285,6 +285,7 @@ module.exports = function (strapi) {
process.exit(1); process.exit(1);
} }
strapi.log.info('`' + adapter + '` successfully installed');
done(); done();
}); });
} else { } else {

View File

@ -18,7 +18,6 @@ const async = require('async');
module.exports = cb => { module.exports = cb => {
const self = this; const self = this;
let runDone = null;
console.log(); console.log();
@ -43,6 +42,7 @@ module.exports = cb => {
// Callback. // Callback.
err => { err => {
let count = 0;
// Just in case there is an error. // Just in case there is an error.
if (err) { if (err) {
@ -59,18 +59,20 @@ module.exports = cb => {
if (cluster.isMaster) { if (cluster.isMaster) {
self.hooks.waterline.installation(); self.hooks.waterline.installation();
++runDone; ++count;
if (_.isPlainObject(self.config.view)) { if (_.isPlainObject(self.config.views) && !_.isBoolean(self.config.views)) {
self.hooks.views.installation(); self.hooks.views.installation();
++runDone; ++count;
} }
} }
const installed = _.after(runDone, () => { const installed = _.after(count, () => {
self.log.warn('Application is restarting...'); if (_.isPlainObject(strapi.config.reload) && !_.isEmpty(strapi.config.reload) && strapi.config.reload.workers > 0) {
console.log(); self.log.warn('Application is restarting...');
console.log();
}
// Teardown Waterline adapters and // Teardown Waterline adapters and
// reload the Waterline ORM. // reload the Waterline ORM.
@ -108,11 +110,11 @@ module.exports = cb => {
self.hooks.waterline.reload(); self.hooks.waterline.reload();
}); });
strapi.after('hook:waterline:installed', () => { self.after('hook:waterline:installed', () => {
installed(); installed();
}); });
strapi.after('hook:views:installed', () => { self.after('hook:views:installed', () => {
installed(); installed();
}); });
}); });