Skip to content

Commit

Permalink
[fix] Only include .js files as reactors
Browse files Browse the repository at this point in the history
Do not try to load `.swp` files, etc.
  • Loading branch information
mmalecki committed Jun 13, 2013
1 parent a09715e commit 20bd2c9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions lib/godot/reactor/index.js
Expand Up @@ -6,6 +6,7 @@
*/

var fs = require('fs'),
path = require('path'),
utile = require('utile');

//
Expand Down Expand Up @@ -58,7 +59,7 @@ reactor.register = function (method, Stream) {
//
fs.readdirSync(__dirname)
.filter(function (file) {
return !~core.indexOf(file);
return !~core.indexOf(file) && path.extname(file) === '.js';
})
.forEach(function (file) {
var name = file.replace('.js', ''),
Expand All @@ -70,4 +71,4 @@ fs.readdirSync(__dirname)
}

return reactor.register(method, require('./' + name));
});
});
4 changes: 2 additions & 2 deletions test/reactor/reactor-test.js
Expand Up @@ -20,7 +20,7 @@ vows.describe('godot/reactor').addBatch({

fs.readdirSync(reactorDir)
.filter(function (file) {
return !~core.indexOf(file);
return !~core.indexOf(file) && path.extname(file) === '.js';
})
.forEach(function (file) {
var name = file.replace('.js', ''),
Expand All @@ -45,4 +45,4 @@ vows.describe('godot/reactor').addBatch({
}
}
}
}).export(module);
}).export(module);

0 comments on commit 20bd2c9

Please sign in to comment.