express-load
Advanced tools
Comparing version 1.1.9 to 1.1.11
@@ -28,7 +28,7 @@ /*! | ||
for (var environment in app.config) { | ||
app.configure(environment, function() { | ||
if (environment == app.get('env')) { | ||
for (var key in app.config[environment]) { | ||
app.set(key, app.config[environment][key]); | ||
} | ||
}); | ||
} | ||
} | ||
@@ -35,0 +35,0 @@ |
@@ -52,2 +52,7 @@ /*! | ||
this.scripts = []; | ||
if(!options.extlist instanceof RegExp && options.extlist instanceof Array){ | ||
this.__log('Converting extension list to regular expression'); | ||
options.extlist = new RegExp('(.*)\\.(' + options.extlist.join('$|').replace(/\./g,'') + ')'); | ||
}; | ||
this.__log('Using regular expression' + options.extlist + 'for extenstion matching'); | ||
this.then(entity); | ||
@@ -86,4 +91,4 @@ | ||
if (allow && this.options.ignore && dir[file].search(this.options.ignore) != -1) { | ||
this.__log('Ignoring file: ingore option match ' + dir[file], 'warn'); | ||
if (allow && this.options.ignore && script.search(this.options.ignore) != -1) { | ||
this.__log('Ignoring file: ignore option match ' + script, 'warn'); | ||
allow = false; | ||
@@ -103,8 +108,7 @@ } | ||
if(this.options.checkext && (this.options.extlist.indexOf(path.extname(dir[file]))==-1)) { | ||
this.__log('Ignoring file: extension not allowed ' + dir[file], 'warn'); | ||
allow = false; | ||
if(this.options.checkext && fs.statSync(script).isFile() && !this.options.extlist.test(script)) { | ||
this.__log('Ignoring file: extension not allowed ' + script, 'warn'); | ||
allow = false; | ||
} | ||
if (allow) { | ||
@@ -136,2 +140,3 @@ var name = getName(script); | ||
/** | ||
@@ -222,2 +227,3 @@ * Create Namespace function - creates a namespace map. | ||
async.eachSeries(this.scripts, function (script, next) { | ||
delete require.cache[script.fullpath]; | ||
var parts = script.location.split(path.sep) | ||
@@ -255,3 +261,3 @@ , maps = parts.slice(0) | ||
self.__log('All things loaded'); | ||
if(typeof done === 'function') | ||
if(typeof done === 'function') | ||
done(null, instance); | ||
@@ -258,0 +264,0 @@ }); |
{ | ||
"name": "express-load", | ||
"description": "Autoload modules into an Express application instance, config, models, routes, controllers etc...", | ||
"version": "1.1.9", | ||
"version": "1.1.11", | ||
"author": { | ||
@@ -15,3 +15,4 @@ "name": "Jarrad Seers", | ||
{"name": "perfectworks", "email": "perfectworks@gmail.com"}, | ||
{"name": "popomore", "email": "sakura9515@gmail.com"} | ||
{"name": "popomore", "email": "sakura9515@gmail.com"}, | ||
{"name": "vkadam", "email": "vishal.4kadam@gmail.com"} | ||
], | ||
@@ -18,0 +19,0 @@ "main": "index", |
@@ -1,2 +0,1 @@ | ||
# Express Load | ||
@@ -3,0 +2,0 @@ |
Sorry, the diff of this file is not supported yet
512
20888
29
221