diff --git a/.gitignore b/.gitignore
index 2fbb3220..4f315224 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,3 +11,4 @@ bin/convertSettings.json
src/static/js/jquery.js
npm-debug.log
*.DS_Store
+.ep_initialized
diff --git a/src/static/js/pluginfw/plugins.js b/src/static/js/pluginfw/plugins.js
index db0b92e4..5f44bb6f 100644
--- a/src/static/js/pluginfw/plugins.js
+++ b/src/static/js/pluginfw/plugins.js
@@ -98,6 +98,28 @@ if (exports.isClient) {
};
} else {
+exports.callInit = function (cb) {
+ var hooks = require("./hooks");
+ async.map(
+ Object.keys(exports.plugins),
+ function (plugin_name, cb) {
+ var plugin = exports.plugins[plugin_name];
+ fs.stat(path.normalize(path.join(plugin.package.path, ".ep_initialized")), function (err, stats) {
+ if (err) {
+ async.waterfall([
+ function (cb) { fs.writeFile(path.normalize(path.join(plugin.package.path, ".ep_initialized")), 'done', cb); },
+ function (cb) { hooks.aCallAll("init_" + plugin_name, {}, cb); },
+ cb,
+ ]);
+ } else {
+ cb();
+ }
+ });
+ },
+ function () { cb(); }
+ );
+}
+
exports.update = function (cb) {
exports.getPackages(function (er, packages) {
var parts = [];
@@ -109,11 +131,12 @@ exports.update = function (cb) {
exports.loadPlugin(packages, plugin_name, plugins, parts, cb);
},
function (err) {
- exports.plugins = plugins;
+ if (err) cb(err);
+ exports.plugins = plugins;
exports.parts = exports.sortParts(parts);
exports.hooks = exports.extractHooks(exports.parts, "hooks");
- exports.loaded = true;
- cb(err);
+ exports.loaded = true;
+ exports.callInit(cb);
}
);
});
diff --git a/src/templates/index.html b/src/templates/index.html
index 58f68801..ecfa0d9e 100644
--- a/src/templates/index.html
+++ b/src/templates/index.html
@@ -130,6 +130,7 @@
<% } %>