diff --git a/README.md b/README.md index 89f660d..89c5a4e 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,41 @@ # cron-git crontab git task by nodejs + +## usage +```js + var o = { + dir: __dirname, + debug: false, + allowNotice: true, + pull: (params, callback) => pull(params, callback), + push: (params, callback) => push(params, callback), + sync: (callback, params_pull, params_push) => sync(callback, params_pull, params_push), + schedule: (time, callback, params_pull, params_push) => schedule(time, callback, params_pull, params_push) + } +``` + +## params_pull +```js + var params = { + remote: { + repo: 'origin', + branch: 'master' + }, + pull_params: {} + } +``` + +## params_push +```js + var params = { + add: { + path: './*' + }, + commit: { + message: "Committed by cron-git from "+ require('os').hostname() + }, + push_params: ['-u', 'origin', 'master'] + } +```` +## License +Apache-2.0 \ No newline at end of file diff --git a/index.js b/index.js index 8fcc8cb..5539aeb 100644 --- a/index.js +++ b/index.js @@ -8,7 +8,7 @@ module.exports = function(o_params){ /* factory mode */ var o = { - dir: './', + dir: __dirname, debug: false, allowNotice: true, pull: (params, callback) => pull(params, callback), diff --git a/package.json b/package.json index 2e172fc..b7e93e2 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "crontab git task", "main": "index.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "test": "node test.js" }, "repository": { "type": "git",