Skip to content
Browse files

Moved setting of root location to configuration API

  • Loading branch information...
1 parent c94f167 commit 020d2972167c7f4821758a51fb2e6e19ead2438a @chetan51 committed Nov 19, 2010
Showing with 9 additions and 17 deletions.
  1. +1 −1 example/app.js
  2. +8 −16 lib/ni.js
View
2 example/app.js
@@ -22,7 +22,7 @@ var Connect = require('connect'),
* Load Ni and start the server.
*/
-Ni.setRoot(__dirname); // Tells Ni where to look for the folders
+Ni.config('root', __dirname); // Tells Ni where to look for the folders
Ni.config('location', "world"); // Sets a custom configuration variable to use
// later, anywhere
View
24 lib/ni.js
@@ -58,31 +58,23 @@ var Ni = function() {
this.config('automatic_views', false);
/*
- * Tells Ni what root directory to look into.
- *
- * Call this function before calling boot.
- */
-
- this.setRoot = function(__root) {
-
- this.__root = __root;
-
- }
-
- /*
* Loads controllers, models, views, templates and helpers from the root
* directory, and makes them all available to the Ni object.
+ *
+ * Before calling this function, make sure you tell Ni where the root
+ * directory is located by setting the configuration variable "root" with
+ * Ni.config('root', LOCATION);
*/
this.boot = function(callbackDone) {
Step(
function bootStrapEverything() {
- bootStrapControllers(Ni.__root, this.parallel());
- bootStrapModels(Ni.__root, this.parallel());
- bootStrapViews(Ni.__root, this.parallel());
- bootStrapLibraries(Ni.__root, this.parallel());
+ bootStrapControllers(Ni.config('root'), this.parallel());
+ bootStrapModels(Ni.config('root'), this.parallel());
+ bootStrapViews(Ni.config('root'), this.parallel());
+ bootStrapLibraries(Ni.config('root'), this.parallel());
},
function buildNi(err, controllers, models, views, libraries) {

0 comments on commit 020d297

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