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.
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);
}
strapi.log.info('`' + engine + '` successfully installed');
done();
});
} else {

View File

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

View File

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