Comparing version 0.0.1 to 0.0.2
{ | ||
"name": "node-cron", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "A simple cron-like task scheduler for Node.js", | ||
"author": "Lucas Merencia", | ||
"license": "ISC", | ||
"homepage": "https://github.com/merencia/cron.js#readme", | ||
"homepage": "https://github.com/merencia/node-cron#readme", | ||
"main": "src/cron.js", | ||
"scripts": { | ||
"test": "mocha -t 20000", | ||
"coverage": "./node_modules/istanbul/lib/cli.js cover _mocha -- -t 200000" | ||
"coverage": "istanbul cover _mocha -- -t 2000000", | ||
"coveralls": "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js", | ||
"check": "npm run coverage && npm run coveralls" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/merencia/cron.js.git" | ||
"url": "git+https://github.com/merencia/node-cron.git" | ||
}, | ||
@@ -25,5 +27,6 @@ "keywords": [ | ||
"bugs": { | ||
"url": "https://github.com/merencia/cron.js/issues" | ||
"url": "https://github.com/merencia/node-cron/issues" | ||
}, | ||
"devDependencies": { | ||
"coveralls": "^2.11.6", | ||
"expect.js": "^0.3.1", | ||
@@ -30,0 +33,0 @@ "istanbul": "^0.4.2", |
@@ -1,10 +0,63 @@ | ||
# Cron.js | ||
# Node Cron | ||
A simple cron-like job scheduler for Node.js | ||
[![Coverage Status](https://coveralls.io/repos/github/merencia/node-cron/badge.svg?branch=master)](https://coveralls.io/github/merencia/node-cron?branch=master) | ||
[![Dependency Status](https://david-dm.org/merencia/node-cron.svg)](https://david-dm.org/merencia/node-cron) | ||
[![devDependency Status](https://david-dm.org/merencia/node-cron/dev-status.svg)](https://david-dm.org/merencia/node-cron#info=devDependencies) | ||
[![Build Status](https://travis-ci.org/merencia/node-cron.svg?branch=master)](https://travis-ci.org/merencia/node-cron) | ||
## Reference | ||
http://www.gnu.org/software/mcron/manual/html_node/Crontab-file.html | ||
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/crontab.html | ||
node-cron is thiny task scheduller in pure and native JavaScrip for node.js based on [GNU crontab](http://www.gnu.org/software/mcron/manual/html_node/Crontab-file.html). | ||
Besides, node-cron wont stop your node.js application if your task throw an exception, rather than it going to try run your task again in the next time occurrence. | ||
https://en.wikipedia.org/wiki/Cron | ||
## Getting Started | ||
Install node-cron using npm: | ||
```sh | ||
$ npm install --save node-cron | ||
``` | ||
Import node-cron and schedule a task: | ||
```javascript | ||
var cron = require('node-cron'); | ||
cron.schedule('* * * * *', function(){ | ||
console.log('running a task in every minute'); | ||
}); | ||
``` | ||
## Quick Cron Reference | ||
``` | ||
# ┌───────────── min (0 - 59) | ||
# │ ┌────────────── hour (0 - 23) | ||
# │ │ ┌─────────────── day of month (1 - 31) | ||
# │ │ │ ┌──────────────── month (1 - 12) | ||
# │ │ │ │ ┌───────────────── day of week (0 - 6) (0 to 6 are Sunday to Saturday) | ||
# │ │ │ │ │ | ||
# │ │ │ │ │ | ||
# * * * * * | ||
``` | ||
## Issues | ||
Feel free to submit issues and enhancement requests [here](https://github.com/merencia/node-cron/issues). | ||
## Contributors | ||
In general, we follow the "fork-and-pull" Git workflow. | ||
- Fork the repo on GitHub; | ||
- Commit changes to a branch in your fork; | ||
- Pull request "upstream" with your changes; | ||
NOTE: Be sure to merge the latest from "upstream" before making a pull request! | ||
Please do not contribute code you did not write yourself, unless you are certain you have the legal ability to do so. Also ensure all contributed code can be distributed under the ISC License. | ||
## License | ||
node-cron is under [ISC License](https://github.com/merencia/node-cron/blob/master/LICENSE.md). |
@@ -18,3 +18,4 @@ 'use strict'; | ||
var executed = 0; | ||
var initialDate = new Date(2015, 2, 1); | ||
var initialDate = new Date(2015, 2, 31); | ||
this.clock = sinon.useFakeTimers(initialDate.getTime()); | ||
cron.schedule('0 0 1 * *', function(){ | ||
@@ -40,4 +41,3 @@ executed += 1; | ||
it('should execute a task on months multiples of 2', function() { | ||
var initialDate = new Date(); | ||
initialDate.setMinutes(0); | ||
var initialDate = new Date(2015, 2, 31); | ||
this.clock = sinon.useFakeTimers(initialDate.getTime()); | ||
@@ -48,5 +48,5 @@ var executed = 0; | ||
}); | ||
this.clock.tick(1000 * 60 * 60 * 24 * 31 * 3); | ||
this.clock.tick(1000 * 60 * 60 * 24 * 63); | ||
expect(executed).to.equal(2); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11704
12
64
5