Skip to content
This repository
Browse code

Last nail in the globals coffin.

  • Loading branch information...
commit 0cfee4cbed0154a07b65868e51b41c773837224f 1 parent 18a3b70
Matthew Eernisse authored June 05, 2010
4  geddy-core/lib/app.js
@@ -99,7 +99,7 @@ var App = function (initData) {
99 99
             log.debug('params: ' + JSON.stringify(params))
100 100
 
101 101
             // Instantiate the matching controller from the registry
102  
-            constructor = controllerRegistry[params.controller];
  102
+            constructor = geddy.controllerRegistry[params.controller];
103 103
             // Give it all the base Controller fu
104 104
             constructor.prototype = new Controller({
105 105
               request: req,
@@ -112,7 +112,7 @@ var App = function (initData) {
112 112
             controller = new constructor();
113 113
 
114 114
             // Mix in any user-defined Application methods
115  
-            mixin = new controllerRegistry.Application();
  115
+            mixin = new geddy.controllerRegistry.Application();
116 116
             controller = geddy.util.meta.mixin(controller, mixin);
117 117
             
118 118
             // All righty, let's handle the action
4  geddy-core/lib/controller.js
@@ -316,13 +316,13 @@ Controller.prototype = new function () {
316 316
    
317 317
     if (!url) {
318 318
       key = parentNode.dirname + '/' + partial + '.html.ejs';
319  
-      if (templateRegistry[key]) {
  319
+      if (geddy.templateRegistry[key]) {
320 320
         url = key;
321 321
       }
322 322
     }
323 323
     if (!url) {
324 324
       key = 'app/views/' + partial + '.html.ejs';
325  
-      if (templateRegistry[key]) {
  325
+      if (geddy.templateRegistry[key]) {
326 326
         url = key;
327 327
       }
328 328
     }
17  geddy-core/lib/init.js
@@ -34,10 +34,10 @@ var Init = function (config, callback) {
34 34
   geddy.hooks = require('geddy-core/lib/hooks');
35 35
   geddy.inflections = require(geddy.config.dirname + '/config/inflections');
36 36
 
37  
-  global.controllerRegistry = {};
38  
-  global.templateRegistry = {};
39  
-  global.pluginRegistry = {};
40  
-  
  37
+  geddy.controllerRegistry = {};
  38
+  geddy.templateRegistry = {};
  39
+  geddy.pluginRegistry = {};
  40
+
41 41
   // Load anything in from the app's local init
42 42
   var localInit = require(geddy.config.dirname + '/config/init');
43 43
   for (var p in localInit) {
@@ -49,7 +49,8 @@ var Init = function (config, callback) {
49 49
       sys.puts('Error: ' + JSON.stringify(err));
50 50
     }
51 51
     else {
52  
-      controllerRegistry = geddy.util.meta.registerConstructors('/app/controllers/', dirList);
  52
+      geddy.controllerRegistry =
  53
+          geddy.util.meta.registerConstructors('/app/controllers/', dirList);
53 54
     }
54 55
   };
55 56
 
@@ -72,7 +73,7 @@ var Init = function (config, callback) {
72 73
           templates[file] = true;
73 74
         }
74 75
       }
75  
-      templateRegistry = templates;
  76
+      geddy.templateRegistry = templates;
76 77
     }
77 78
   };
78 79
 
@@ -91,7 +92,7 @@ var Init = function (config, callback) {
91 92
       cfg = plugins[pluginName];
92 93
       pathName = fleegix.string.deCamelize(pluginName);
93 94
       path = geddy.config.dirname + '/plugins/' + pathName + '/' + pathName;
94  
-      pluginRegistry[pluginName] = new require(path)[pluginName](cfg);
  95
+      geddy.pluginRegistry[pluginName] = new require(path)[pluginName](cfg);
95 96
     }
96 97
   };
97 98
 
@@ -126,7 +127,7 @@ var Init = function (config, callback) {
126 127
       callback: this.registerTemplates
127 128
     }
128 129
   ]);
129  
-  
  130
+
130 131
   group.last = _callback;
131 132
   group.run();
132 133
 

0 notes on commit 0cfee4c

Please sign in to comment.
Something went wrong with that request. Please try again.