Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

some fix in module lib

  • Loading branch information...
commit 45479f9952c45ff991a4695bdcff219284dab1d5 1 parent 9589a91
@Shogun147 authored
Showing with 28 additions and 20 deletions.
  1. +28 −20 lib/module.js
View
48 lib/module.js
@@ -74,23 +74,31 @@ var modules = {};
module.exports = Module = function(module) {
if (module === '*') {
- return modules;
+ var mods = {};
+
+ for(var m in modules) {
+ mods[m] = modules[m].module;
+ }
+
+ return mods;
} else if (module) {
- return modules[module];
+ return modules[module].module;
}
return Katana.Core.Module;
}
-for (var module in App.info.katana.modules) {
- if (App.info.katana.modules[module].enabled) {
- modules[module] = module;
+var info = require(root +'package');
+
+for (var module in info.katana.modules) {
+ if (info.katana.modules[module].enabled) {
+ modules[module] = { module: module, controllers: [] };
}
}
App.on('boot.config', function(callback) {
for (module in modules) {
- Config.load(module);
+ Config.load(module);
}
callback();
@@ -102,9 +110,9 @@ App.on('boot.models', function(callback) {
if (!pending) { callback(); }
for (module in modules) {
- Model.load(module, function() {
- if (!--pending) { return callback(); }
- });
+ Model.load(module, function() {
+ if (!--pending) { return callback(); }
+ });
}
});
@@ -114,15 +122,15 @@ App.on('boot.views', function(callback) {
if (!pending) { return callback(); }
for (module in modules) {
- View.load(module, function() {
- if (!--pending) { callback(); }
- })
+ View.load(module, function() {
+ if (!--pending) { callback(); }
+ });
}
});
App.on('boot.modules', function(callback) {
for (module in modules) {
- modules[module] = require(root +'modules/'+ module);
+ modules[module].module = require(root +'modules/'+ module);
}
callback();
@@ -134,12 +142,12 @@ App.on('boot.controllers', function(callback) {
if (!pending) { return callback(); }
Object.keys(modules).forEach(function(module) {
- load(root +'modules/'+ module +'/controllers', function(error, controllers) {
- if (error) { throw error; }
-
- modules[module].controllers = controllers;
-
- if (!--pending) { callback(); }
- });
+ load(root +'modules/'+ module +'/controllers', function(error, controllers) {
+ if (error) { throw error; }
+
+ modules[module].controllers = controllers;
+
+ if (!--pending) { callback(); }
+ });
});
});
Please sign in to comment.
Something went wrong with that request. Please try again.