Skip to content

Commit

Permalink
Merge pull request #113 from synthmeat/master
Browse files Browse the repository at this point in the history
replace 'package' keyword with 'pkg'
  • Loading branch information
evantahler committed Jan 10, 2016
2 parents b11dd1f + cabcf8b commit eb0c99a
Show file tree
Hide file tree
Showing 13 changed files with 29 additions and 29 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var NR = require("node-resque");
///////////////////////////

var connectionDetails = {
package: 'ioredis',
pkg: 'ioredis',
host: '127.0.0.1',
password: null,
port: 6379,
Expand Down Expand Up @@ -131,7 +131,7 @@ The configuration hash passed to `new worker`, `new scheduler` or `new queue` ca

```javascript
var connectionDetails = {
package: "ioredis",
pkg: "ioredis",
host: "127.0.0.1",
password: "",
port: 6379,
Expand Down Expand Up @@ -387,7 +387,7 @@ node-resque provides a wrapper around the `worker` object which will auto-scale
var NR = require(__dirname + "/../index.js");
var connectionDetails = {
package: "ioredis",
pkg: "ioredis",
host: "127.0.0.1",
password: ""
}
Expand Down
2 changes: 1 addition & 1 deletion examples/customPluginExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var NR = require(__dirname + "/../index.js");
///////////////////////////

var connectionDetails = {
package: 'ioredis',
pkg: 'ioredis',
host: '127.0.0.1',
password: null,
port: 6379,
Expand Down
2 changes: 1 addition & 1 deletion examples/errorExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var NR = require(__dirname + "/../index.js");
///////////////////////////

var connectionDetails = {
package: 'ioredis',
pkg: 'ioredis',
host: '127.0.0.1',
password: null,
port: 6379,
Expand Down
2 changes: 1 addition & 1 deletion examples/example.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var NR = require(__dirname + "/../index.js");
///////////////////////////

var connectionDetails = {
package: 'ioredis',
pkg: 'ioredis',
host: '127.0.0.1',
password: null,
port: 6379,
Expand Down
2 changes: 1 addition & 1 deletion examples/multiWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
var NR = require(__dirname + "/../index.js");

var connectionDetails = {
package: 'ioredis',
pkg: 'ioredis',
host: '127.0.0.1',
password: null,
port: 6379,
Expand Down
2 changes: 1 addition & 1 deletion examples/scheduledJobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var schedule = require('node-schedule');
///////////////////////////

var connectionDetails = {
package: 'ioredis',
pkg: 'ioredis',
host: '127.0.0.1',
password: null,
port: 6379,
Expand Down
10 changes: 5 additions & 5 deletions lib/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ util.inherits(connection, EventEmitter);

connection.prototype.defaults = function(){
return {
package: 'ioredis',
pkg: 'ioredis',
host: '127.0.0.1',
port: 6379,
database: 0,
Expand Down Expand Up @@ -47,8 +47,8 @@ connection.prototype.connect = function(callback){

}else{

var package = require(self.options.package);
self.redis = package.createClient(self.options.port, self.options.host, self.options.options);
var pkg = require(self.options.pkg);
self.redis = pkg.createClient(self.options.port, self.options.host, self.options.options);

var handleConnection = function(){
if(self.connected === true){
Expand All @@ -67,7 +67,7 @@ connection.prototype.connect = function(callback){
};

self.redis.on('connect', handleConnection);
if(self.options.package === 'fakeredis'){ process.nextTick(handleConnection); }
if(self.options.pkg === 'fakeredis'){ process.nextTick(handleConnection); }
}

self.redis.on('error', function(err){
Expand All @@ -83,7 +83,7 @@ connection.prototype.end = function(){
var self = this;
self.connected = false;
// Only disconnect if we established the redis connection on our own.
if (!self.options.redis && self.options.package !== 'fakeredis'){
if (!self.options.redis && self.options.pkg !== 'fakeredis'){
if(typeof self.redis.disconnect === 'function'){ self.redis.disconnect(); }
else{ self.redis.quit(); }
}
Expand Down
16 changes: 8 additions & 8 deletions test/_specHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ var fakeredis = require('fakeredis');
var namespace = "resque_test";
var queue = "test_queue";

var package = 'ioredis';
if(process.env.FAKEREDIS === 'true'){ package = 'fakeredis'; }
var pkg = 'ioredis';
if(process.env.FAKEREDIS === 'true'){ pkg = 'fakeredis'; }

console.log("Using " + package);
console.log("Using " + pkg);

exports.specHelper = {
package: package,
pkg: pkg,
NR: require(__dirname + "/../index.js"),
namespace: namespace,
queue: queue,
timeout: 500,
connectionDetails: {
package: package,
pkg: pkg,
host: "127.0.0.1",
password: "",
port: 6379,
Expand All @@ -25,7 +25,7 @@ exports.specHelper = {
},
connect: function(callback){
var self = this;
if(package != 'fakeredis'){
if(pkg != 'fakeredis'){
self.redis = redis.createClient(self.connectionDetails.port, self.connectionDetails.host, self.connectionDetails.options);
self.redis.setMaxListeners(0);
if(self.connectionDetails.password != null && self.connectionDetails.password != ""){
Expand Down Expand Up @@ -93,7 +93,7 @@ exports.specHelper = {
cleanConnectionDetails: function(){
var self = this;
var out = {};
if(self.package === 'fakeredis'){
if(self.pkg === 'fakeredis'){
return self.connectionDetails;
}
for(var i in self.connectionDetails){
Expand All @@ -104,4 +104,4 @@ exports.specHelper = {

return out;
}
}
}
4 changes: 2 additions & 2 deletions test/core/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('connection', function(){
}

var connectionDetails = {
package: specHelper.connectionDetails.package,
pkg: specHelper.connectionDetails.pkg,
host: "wronghostname",
password: specHelper.connectionDetails.password,
port: specHelper.connectionDetails.port,
Expand Down Expand Up @@ -58,4 +58,4 @@ describe('connection', function(){
});
});

});
});
4 changes: 2 additions & 2 deletions test/core/multiWorker.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var specHelper = require(__dirname + "/../_specHelper.js").specHelper;
var should = require('should');

if(specHelper.package === 'fakeredis'){
if(specHelper.pkg === 'fakeredis'){
console.log("multiWorker does not work with fakeredis for now...");
}else{

Expand Down Expand Up @@ -139,4 +139,4 @@ if(specHelper.package === 'fakeredis'){
});

});
}
}
2 changes: 1 addition & 1 deletion test/core/queue.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe('queue', function(){
}

var connectionDetails = {
package: specHelper.connectionDetails.package,
pkg: specHelper.connectionDetails.pkg,
host: "wronghostname",
password: specHelper.connectionDetails.password,
port: specHelper.connectionDetails.port,
Expand Down
4 changes: 2 additions & 2 deletions test/core/scheduler.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('scheduler', function(){

it("can provide an error if connection does not establish for a long period", function(done) {
var connectionDetails = {
package: specHelper.connectionDetails.package,
pkg: specHelper.connectionDetails.pkg,
host: "wronghostname",
password: specHelper.connectionDetails.password,
port: specHelper.connectionDetails.port,
Expand Down Expand Up @@ -54,7 +54,7 @@ describe('scheduler', function(){
}

var connectionDetails = {
package: specHelper.connectionDetails.package,
pkg: specHelper.connectionDetails.pkg,
host: "wronghostname",
password: specHelper.connectionDetails.password,
port: specHelper.connectionDetails.port,
Expand Down
2 changes: 1 addition & 1 deletion test/core/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe('worker', function(){
}

var connectionDetails = {
package: specHelper.connectionDetails.package,
pkg: specHelper.connectionDetails.pkg,
host: "wronghostname",
password: specHelper.connectionDetails.password,
port: specHelper.connectionDetails.port,
Expand Down

0 comments on commit eb0c99a

Please sign in to comment.