Permalink
Browse files

Last nail in the globals coffin.

  • Loading branch information...
1 parent 18a3b70 commit 0cfee4cbed0154a07b65868e51b41c773837224f @mde mde committed Jun 6, 2010
Showing with 13 additions and 12 deletions.
  1. +2 −2 geddy-core/lib/app.js
  2. +2 −2 geddy-core/lib/controller.js
  3. +9 −8 geddy-core/lib/init.js
View
@@ -99,7 +99,7 @@ var App = function (initData) {
log.debug('params: ' + JSON.stringify(params))
// Instantiate the matching controller from the registry
- constructor = controllerRegistry[params.controller];
+ constructor = geddy.controllerRegistry[params.controller];
// Give it all the base Controller fu
constructor.prototype = new Controller({
request: req,
@@ -112,7 +112,7 @@ var App = function (initData) {
controller = new constructor();
// Mix in any user-defined Application methods
- mixin = new controllerRegistry.Application();
+ mixin = new geddy.controllerRegistry.Application();
controller = geddy.util.meta.mixin(controller, mixin);
// All righty, let's handle the action
@@ -316,13 +316,13 @@ Controller.prototype = new function () {
if (!url) {
key = parentNode.dirname + '/' + partial + '.html.ejs';
- if (templateRegistry[key]) {
+ if (geddy.templateRegistry[key]) {
url = key;
}
}
if (!url) {
key = 'app/views/' + partial + '.html.ejs';
- if (templateRegistry[key]) {
+ if (geddy.templateRegistry[key]) {
url = key;
}
}
View
@@ -34,10 +34,10 @@ var Init = function (config, callback) {
geddy.hooks = require('geddy-core/lib/hooks');
geddy.inflections = require(geddy.config.dirname + '/config/inflections');
- global.controllerRegistry = {};
- global.templateRegistry = {};
- global.pluginRegistry = {};
-
+ geddy.controllerRegistry = {};
+ geddy.templateRegistry = {};
+ geddy.pluginRegistry = {};
+
// Load anything in from the app's local init
var localInit = require(geddy.config.dirname + '/config/init');
for (var p in localInit) {
@@ -49,7 +49,8 @@ var Init = function (config, callback) {
sys.puts('Error: ' + JSON.stringify(err));
}
else {
- controllerRegistry = geddy.util.meta.registerConstructors('/app/controllers/', dirList);
+ geddy.controllerRegistry =
+ geddy.util.meta.registerConstructors('/app/controllers/', dirList);
}
};
@@ -72,7 +73,7 @@ var Init = function (config, callback) {
templates[file] = true;
}
}
- templateRegistry = templates;
+ geddy.templateRegistry = templates;
}
};
@@ -91,7 +92,7 @@ var Init = function (config, callback) {
cfg = plugins[pluginName];
pathName = fleegix.string.deCamelize(pluginName);
path = geddy.config.dirname + '/plugins/' + pathName + '/' + pathName;
- pluginRegistry[pluginName] = new require(path)[pluginName](cfg);
+ geddy.pluginRegistry[pluginName] = new require(path)[pluginName](cfg);
}
};
@@ -126,7 +127,7 @@ var Init = function (config, callback) {
callback: this.registerTemplates
}
]);
-
+
group.last = _callback;
group.run();

0 comments on commit 0cfee4c

Please sign in to comment.