This commit is contained in:
kts of kettek(MindFire) 2019-01-15 22:19:46 -05:00
commit 0faf8bffe5
2 changed files with 39 additions and 0 deletions

25
index.js Normal file
View File

@ -0,0 +1,25 @@
var config = module.parent._require('config.js');
module.exports = function(plugin) {
plugin.defaults({
"interval": 60 * 1000
});
var sgit = require('simple-git')(config['wiki_dir']);
function update() {
sgit.pull(function(err, update) {
plugin.emit("pre-update");
if (err) {
plugin.emit("error");
console.log('E: ' + 'autogit: ' + err);
}
plugin.emit("post-update");
})
}
sgit.checkIsRepo(function(isRepo = true) {
console.log('I: ' + 'autogit: updating every ' + plugin.conf['interval'] + 'ms');
plugin.emit('load');
setInterval(update, plugin.conf['interval']);
});
};

14
package.json Normal file
View File

@ -0,0 +1,14 @@
{
"name": "ngwiki-plugin-autogit",
"version": "1.0.0",
"description": "ngwiki plugin that periodically updates the git repository located at wiki_dir",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Ketchetwahmeegwun T. Southall",
"license": "GPL-3.0",
"dependencies": {
"simple-git": "^1.91.0"
}
}