Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[v0.6] Remove mutable `require.paths` references

Fixes #1.
  • Loading branch information...
commit 104f15f0ab961e24adcdf3500c120900ee1c0566 1 parent eabd28b
@mmalecki mmalecki authored
View
13 lib/neuron.js
@@ -6,8 +6,6 @@
*
*/
-require.paths.unshift(__dirname);
-
var neuron = exports;
//
@@ -19,10 +17,10 @@ neuron.version = [0, 4, 0];
// ### Export Components
// Export each of the core prototypes exposed by neuron.
//
-neuron.JobManager = require('neuron/job-manager').JobManager;
-neuron.Job = require('neuron/job').Job;
-neuron.Worker = require('neuron/worker').Worker;
-neuron.WorkerCache = require('neuron/worker-cache').WorkerCache;
+neuron.JobManager = require('./neuron/job-manager').JobManager;
+neuron.Job = require('./neuron/job').Job;
+neuron.Worker = require('./neuron/worker').Worker;
+neuron.WorkerCache = require('./neuron/worker-cache').WorkerCache;
//
// ### function randomString (bits)
@@ -46,4 +44,5 @@ neuron.randomString = function (bits) {
}
}
return ret;
-};
+};
+
View
5 lib/neuron/job-manager.js
@@ -8,7 +8,7 @@
var util = require('util'),
events = require('events'),
- neuron = require('neuron');
+ neuron = require('../neuron');
//
// ### function JobManager (options)
@@ -213,4 +213,5 @@ JobManager.prototype.load = function () {
self.emit('load');
});
-};
+};
+
View
5 lib/neuron/job.js
@@ -8,7 +8,7 @@
var util = require('util'),
events = require('events'),
- neuron = require('neuron');
+ neuron = require('../neuron');
//
// ### function Job (jobName, props)
@@ -191,4 +191,5 @@ Job.prototype._replenish = function () {
}
return started;
-};
+};
+
View
5 lib/neuron/worker-cache.js
@@ -10,7 +10,7 @@ var util = require('util'),
events = require('events'),
async = require('async'),
redis = require('redis'),
- neuron = require('neuron');
+ neuron = require('../neuron');
//
// ### function WorkerCache (options)
@@ -211,4 +211,5 @@ WorkerCache.prototype.key = function () {
args.unshift(this.namespace);
return args.join(':');
-};
+};
+
View
5 lib/neuron/worker.js
@@ -8,7 +8,7 @@
var util = require('util'),
events = require('events'),
- neuron = require('neuron');
+ neuron = require('../neuron');
//
// ### function Worker (workerId, job, args)
@@ -62,4 +62,5 @@ Worker.prototype.__defineSetter__('finished', function (value) {
this.running = false;
this.emit('finish');
}
-});
+});
+
View
4 test/job-manager-cache-test.js
@@ -5,15 +5,13 @@
*
*/
-require.paths.unshift(require('path').join(__dirname, '..', 'lib'));
-
var sys = require('sys'),
fs = require('fs'),
path = require('path'),
vows = require('vows'),
assert = require('assert'),
async = require('async'),
- neuron = require('neuron'),
+ neuron = require('../lib/neuron'),
helpers = require('./helpers');
vows.describe('neuron/job-manager/cache').addBatch({
View
7 test/job-manager-concurrency-test.js
@@ -5,14 +5,12 @@
*
*/
-require.paths.unshift(require('path').join(__dirname, '..', 'lib'));
-
var sys = require('sys'),
fs = require('fs'),
path = require('path'),
vows = require('vows'),
assert = require('assert'),
- neuron = require('neuron'),
+ neuron = require('../lib/neuron'),
helpers = require('./helpers');
var workerIds = [];
@@ -87,4 +85,5 @@ vows.describe('neuron/job-manager/simple').addBatch(
assert.equal(manager.jobs['waitRespond'].queue.length, 0);
}
}, 30000)
-).export(module);
+).export(module);
+
View
7 test/job-manager-simple-test.js
@@ -4,15 +4,13 @@
* (C) 2010 Charlie Robbins
*
*/
-
-require.paths.unshift(require('path').join(__dirname, '..', 'lib'));
var sys = require('sys'),
fs = require('fs'),
path = require('path'),
vows = require('vows'),
assert = require('assert'),
- neuron = require('neuron'),
+ neuron = require('../lib/neuron'),
helpers = require('./helpers');
var workerId;
@@ -83,4 +81,5 @@ vows.describe('neuron/job-manager/simple').addBatch({
}
}
}
-}).export(module);
+}).export(module);
+
View
7 test/job-test.js
@@ -5,14 +5,12 @@
*
*/
-require.paths.unshift(require('path').join(__dirname, '..', 'lib'));
-
var sys = require('sys'),
fs = require('fs'),
path = require('path'),
vows = require('vows'),
assert = require('assert'),
- neuron = require('neuron'),
+ neuron = require('../lib/neuron'),
helpers = require('./helpers');
vows.describe('neuron/job').addBatch({
@@ -58,4 +56,5 @@ vows.describe('neuron/job').addBatch({
}
}
}
-}).export(module);
+}).export(module);
+
View
7 test/worker-cache-test.js
@@ -5,11 +5,9 @@
*
*/
-require.paths.unshift(require('path').join(__dirname, '..', 'lib'));
-
var vows = require('vows'),
assert = require('assert'),
- neuron = require('neuron'),
+ neuron = require('../lib/neuron'),
helpers = require('./helpers');
vows.describe('neuron/worker-cache').addBatch({
@@ -89,4 +87,5 @@ vows.describe('neuron/worker-cache').addBatch({
}
}
}
-}).export(module);
+}).export(module);
+
View
7 test/worker-test.js
@@ -5,14 +5,12 @@
*
*/
-require.paths.unshift(require('path').join(__dirname, '..', 'lib'));
-
var sys = require('sys'),
fs = require('fs'),
path = require('path'),
vows = require('vows'),
assert = require('assert'),
- neuron = require('neuron'),
+ neuron = require('../lib/neuron'),
helpers = require('./helpers');
var worker;
@@ -51,4 +49,5 @@ vows.describe('neuron/worker').addBatch({
}
}
}
-}).export(module);
+}).export(module);
+
Please sign in to comment.
Something went wrong with that request. Please try again.