cron
Advanced tools
Comparing version 1.1.0 to 1.1.1
{ | ||
"name": "cronjs", | ||
"version": "1.0.1", | ||
"homepage": "https://github.com/ncb000gt/node-cron", | ||
@@ -13,3 +12,4 @@ "authors": [ | ||
"humanchimp", | ||
"danhbear" | ||
"danhbear", | ||
"Jordan Abderrachid<jabderrachid@gmail.com>" | ||
], | ||
@@ -16,0 +16,0 @@ "description": "js cron handler", |
@@ -8,4 +8,11 @@ var exports, | ||
this.source = source; | ||
this.zone = zone; | ||
if (zone) { | ||
if (moment.tz.names().indexOf(zone) === -1) { | ||
throw new Error('Invalid timezone.'); | ||
} | ||
this.zone = zone; | ||
} | ||
var that = this; | ||
@@ -417,2 +424,3 @@ timeUnits.map(function(timeUnit){ | ||
self.lastExecution = new Date(); | ||
if (remaining) { | ||
@@ -461,2 +469,6 @@ if (remaining > MAXDELAY) { | ||
CronJob.prototype.lastDate = function(){ | ||
return this.lastExecution; | ||
}; | ||
/** | ||
@@ -463,0 +475,0 @@ * Stop the cronjob. |
{ | ||
"name": "cron", | ||
"description": "Cron jobs for your node", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"author": "Nick Campbell <nicholas.j.campbell@gmail.com> (http://github.com/ncb000gt)", | ||
@@ -18,3 +18,3 @@ "bugs" : { | ||
"dependencies": { | ||
"moment-timezone": "~0.3.0" | ||
"moment-timezone": "~0.5.5" | ||
}, | ||
@@ -26,8 +26,3 @@ "devDependencies": { | ||
}, | ||
"licenses": [ | ||
{ | ||
"type": "MIT", | ||
"url": "http://www.opensource.org/licenses/mit-license.php" | ||
} | ||
], | ||
"license": "MIT", | ||
"contributors": [ | ||
@@ -44,4 +39,5 @@ "Romain Beauxis <toots@rastageeks.org> (https://github.com/toots)", | ||
"Leandro Ferrari <lfthomaz@gmail.com> (https://github.com/lfthomaz)", | ||
"Gregg Zigler <greggzigler@gmail.com> (https://github.com/greggzigler)" | ||
"Gregg Zigler <greggzigler@gmail.com> (https://github.com/greggzigler)", | ||
"Jordan Abderrachid <jabderrachid@gmail.com> (https://github.com/jordanabderrachid)" | ||
] | ||
} |
node-cron | ||
========= | ||
[![Build Status](https://secure.travis-ci.org/ncb000gt/node-cron.png)](http://travis-ci.org/#!/ncb000gt/node-cron) | ||
[![Build Status](https://secure.travis-ci.org/ncb000gt/node-cron.svg?branch=master)](http://travis-ci.org/#!/ncb000gt/node-cron) | ||
[![wercker status](https://app.wercker.com/status/0cadfe5d45ad7bc819efb636026cf230/s "wercker status")](https://app.wercker.com/project/bykey/0cadfe5d45ad7bc819efb636026cf230) | ||
[![Dependency Status](https://david-dm.org/ncb000gt/node-cron.svg)](https://david-dm.org/ncb000gt/node-cron) | ||
@@ -19,3 +20,3 @@ Originally this project was a NodeJS fork of [James Padolsey's][jamespadolsey] [cron.js](http://github.com/padolsey/cron.js). | ||
Versions and Backwards compatability breaks: | ||
Versions and Backwards compatibility breaks: | ||
========== | ||
@@ -53,3 +54,5 @@ | ||
[Read up on cron patterns here](http://crontab.org). | ||
[Read up on cron patterns here](http://crontab.org). Note the examples in the | ||
link have five fields, and 1 minute as the finest granularity, but this library | ||
has six fields, with 1 second as the finest granularity. | ||
@@ -147,3 +150,3 @@ Cron Ranges | ||
Parameter Based | ||
Parameter Based | ||
@@ -157,3 +160,3 @@ `CronJob` | ||
* `start` - [OPTIONAL] - Specifies whether to start the job just before exiting the constructor. By default this is set to false. If left at default you will need to call `job.start()` in order to start the job (assuming `job` is the variable you set the cronjob to). This does not immediately fire your `onTick` function, it just gives you more control over the behavior of your jobs. | ||
* `timeZone` - [OPTIONAL] - Specify the timezone for the execution. This will modify the actual time relative to your timezone. | ||
* `timeZone` - [OPTIONAL] - Specify the timezone for the execution. This will modify the actual time relative to your timezone. If the timezone is invalid, an error is thrown. | ||
* `context` - [OPTIONAL] - The context within which to execute the onTick method. This defaults to the cronjob itself allowing you to call `this.stop()`. However, if you change this you'll have access to the functions and values within your context object. | ||
@@ -180,2 +183,3 @@ * `runOnInit` - [OPTIONAL] - This will immediately fire your `onTick` function as soon as the requisit initialization has happened. This option is set to `false` by default for backwards compatability. | ||
* [danhbear][danhbear] | ||
* [Jordan Abderrachid][jordanabderrachid] | ||
@@ -196,1 +200,2 @@ License | ||
[danhbear]:http://github.com/danhbear | ||
[jordanabderrachid]:http://github.com/jordanabderrachid |
@@ -360,2 +360,12 @@ var chai = require('chai'), | ||
}); | ||
it('should test if timezone is valid.', function () { | ||
expect(function () { | ||
new cron.CronJob({ | ||
cronTime: '* * * * * *', | ||
onTick: function (){}, | ||
timeZone: 'fake/timezone' | ||
}); | ||
}).to.throw(Error); | ||
}); | ||
}); | ||
@@ -420,3 +430,3 @@ | ||
job.setTime(time); | ||
}).to.throw; | ||
}).to.throw(Error); | ||
@@ -423,0 +433,0 @@ clock.restore(); |
@@ -9,3 +9,3 @@ var chai = require('chai'), | ||
new cron.CronTime('* * * * * *'); | ||
}).to.not.throw; | ||
}).to.not.throw(Error); | ||
}); | ||
@@ -16,3 +16,3 @@ | ||
new cron.CronTime('0 * * * * *'); | ||
}).to.not.throw; | ||
}).to.not.throw(Error); | ||
}); | ||
@@ -23,3 +23,3 @@ | ||
new cron.CronTime('08 * * * * *'); | ||
}).to.not.throw; | ||
}).to.not.throw(Error); | ||
}); | ||
@@ -30,3 +30,3 @@ | ||
new cron.CronTime('08 * * * * *'); | ||
}).to.not.throw; | ||
}).to.not.throw(Error); | ||
}); | ||
@@ -37,3 +37,3 @@ | ||
new cron.CronTime('08 * * * * *'); | ||
}).to.not.throw; | ||
}).to.not.throw(Error); | ||
}); | ||
@@ -44,3 +44,3 @@ | ||
new cron.CronTime('* * * * *'); | ||
}).to.not.throw; | ||
}).to.not.throw(Error); | ||
}); | ||
@@ -64,3 +64,3 @@ | ||
new cron.CronTime('0-10 * * * * *'); | ||
}).to.not.throw; | ||
}).to.not.throw(Error); | ||
}); | ||
@@ -71,3 +71,3 @@ | ||
new cron.CronTime('0-10 0-10 * * * *'); | ||
}).to.not.throw; | ||
}).to.not.throw(Error); | ||
}); | ||
@@ -78,3 +78,3 @@ | ||
new cron.CronTime('0-10 0-10 0-10 0-10 0-10 0-1'); | ||
}).to.not.throw; | ||
}).to.not.throw(Error); | ||
}); | ||
@@ -85,3 +85,3 @@ | ||
new cron.CronTime('0,10 * * * * *'); | ||
}).to.not.throw; | ||
}).to.not.throw(Error); | ||
}); | ||
@@ -92,3 +92,3 @@ | ||
new cron.CronTime('0,10 0,10 * * * *'); | ||
}).to.not.throw; | ||
}).to.not.throw(Error); | ||
}); | ||
@@ -99,3 +99,3 @@ | ||
new cron.CronTime('0,10 0,10 0,10 0,10 0,10 0,1'); | ||
}).to.not.throw; | ||
}).to.not.throw(Error); | ||
}); | ||
@@ -106,3 +106,3 @@ | ||
new cron.CronTime('* * * * jan *'); | ||
}).to.not.throw; | ||
}).to.not.throw(Error); | ||
}); | ||
@@ -113,3 +113,3 @@ | ||
new cron.CronTime('* * * * jan,feb *'); | ||
}).to.not.throw; | ||
}).to.not.throw(Error); | ||
}); | ||
@@ -120,3 +120,3 @@ | ||
new cron.CronTime('* * * * jan,feb mon,tue'); | ||
}).to.not.throw; | ||
}).to.not.throw(Error); | ||
}); | ||
@@ -129,3 +129,3 @@ | ||
new cron.CronTime('* * * * jar *'); | ||
}).to.throw; | ||
}).to.throw(Error); | ||
}); | ||
@@ -136,3 +136,3 @@ | ||
new cron.CronTime('* * * * j *'); | ||
}).to.throw; | ||
}).to.throw(Error); | ||
}); | ||
@@ -162,3 +162,3 @@ | ||
new cron.CronTime('* * /4 * * *'); | ||
}).to.throw; | ||
}).to.throw(Error); | ||
}); | ||
@@ -201,3 +201,3 @@ | ||
var ct = new cron.CronTime('0 0 0 33 ' + m + ' *'); | ||
}).to.throw; | ||
}).to.throw(Error); | ||
})(ltm[i]); | ||
@@ -210,2 +210,3 @@ } | ||
describe('should throw an exception because `L` not supported', function() { | ||
it('(* * * L * *)', function() { | ||
@@ -215,2 +216,3 @@ expect(function() { | ||
}).to.throw(Error); | ||
}); | ||
@@ -217,0 +219,0 @@ |
196
38576
11
1060
+ Addedmoment-timezone@0.5.45(transitive)
- Removedmoment-timezone@0.3.1(transitive)
Updatedmoment-timezone@~0.5.5