Skip to content

Commit

Permalink
Ignore non JS files in startups
Browse files Browse the repository at this point in the history
  • Loading branch information
crh3675 committed Jun 25, 2017
1 parent 1450764 commit 8c65b87
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions sensei.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ module.exports = {
var components = fs.readdirSync(sensei.paths.components);

components.forEach(function(component) {
if(null == component.match(/\.js/i)) return;

var klass = component.replace(/\.js$/i,'');
_components[klass] = require(path.join(sensei.paths.components, component));
});
Expand All @@ -187,6 +189,8 @@ module.exports = {
var entities = fs.readdirSync(sensei.paths.entities);

entities.forEach(function(entity) {
if(null == entity.match(/\.js/i)) return;

var klass = entity.replace(/\.js$/i,'');
var schema = require(path.join(sensei.paths.entities, entity));
var def = _entities[klass.toLowerCase()] = { id : klass };
Expand Down Expand Up @@ -214,6 +218,8 @@ module.exports = {
var managers = fs.readdirSync(sensei.paths.managers);

managers.forEach(function(manager) {
if(null == manager.match(/\.js/i)) return;

var klass = manager.replace(/\.js$/i,'');
_managers[klass] = require(path.join(sensei.paths.managers, manager));
});
Expand All @@ -229,6 +235,8 @@ module.exports = {
var services = fs.readdirSync(sensei.paths.services);

services.forEach(function(service) {
if(null == service.match(/\.js/i)) return;

var klass = service.replace(/\.js$/i,'');
_services[klass] = require(path.join(sensei.paths.services, service));
});
Expand All @@ -244,6 +252,8 @@ module.exports = {
var policies = fs.readdirSync(sensei.paths.policies);

policies.forEach(function(policy) {
if(null == policy.match(/\.js/i)) return;

var klass = policy.replace(/\.js$/i,'');
_policies[klass] = require(path.join(sensei.paths.policies, policy));
});
Expand Down

0 comments on commit 8c65b87

Please sign in to comment.