Skip to content
Browse files

fixed bug when requiring outside of home directory

  • Loading branch information...
1 parent 5c54bec commit 538b70dd410368636bcb974418b1f642ffc993d6 @tblobaum committed Dec 17, 2011
Showing with 34 additions and 35 deletions.
  1. +32 −1 index.js
  2. +0 −32 lib/directory.js
  3. +2 −2 package.json
  4. 0 test/directory.js
View
33 index.js
@@ -1 +1,32 @@
-module.exports = require('./lib/directory')
+
+/*!
+ * node-directory
+ * Copyright(c) Thomas Blobaum
+ * MIT Licensed
+ */
+
+function modulate (dirname, callback) {
+
+ if (!callback) {
+ var callback = dirname
+ }
+
+ if (typeof dirname == 'function') {
+ var dirname = module.parent.paths[0].split("node_modules")[0]
+ }
+
+
+ var paths = require('findit').sync(dirname)
+
+ paths.forEach(function (path) {
+ if (!path.match(module.parent.id)) {
+ var filename = path.split(dirname)[1].split(".js")[0]
+ callback(require(path), filename)
+ }
+ })
+
+ delete require.cache[__filename]
+}
+
+module.exports = modulate
+
View
32 lib/directory.js
@@ -1,32 +0,0 @@
-
-/*!
- * node-directory
- * Copyright(c) Thomas Blobaum
- * MIT Licensed
- */
-
-function modulate (dirname, callback) {
-
- if (!callback) {
- var callback = dirname
- }
-
- if (typeof dirname == 'function') {
- var dirname = module.parent.paths[0].split("node_modules")[0]
- }
-
-
- var paths = require('findit').sync(dirname)
-
- paths.forEach(function (path) {
- if (!path.match(module.parent.id)) {
- var filename = path.split(dirname)[1].split(".js")[0]
- callback(require(path), filename)
- }
- })
-
- delete require.cache[__filename]
-}
-
-module.exports = modulate
-
View
4 package.json
@@ -1,8 +1,8 @@
{
"author": "Thomas Blobaum <tblobaum@gmail.com> (https://github.com/tblobaum)",
"name": "directory",
- "description": "require all of the other paths in the current directory",
- "version": "0.0.6",
+ "description": "require everything in a directory",
+ "version": "0.0.61",
"repository": {
"type": "git",
"url": "git://github.com/tblobaum/node-directory.git"
View
0 test/directory.js
No changes.

0 comments on commit 538b70d

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