-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgitgreen.js
More file actions
33 lines (32 loc) · 1.01 KB
/
gitgreen.js
File metadata and controls
33 lines (32 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*
* Developer : Pearyman (pearyman@gmail.com)
* Date : 06/09/2015
*
* Copyright 2015
* Licensed under MIT
*
* Version: 1.00
*/
var fs = require('fs');
var child_process = require('child_process');
var currentTime = parseInt(new Date().getTime().toString().substr(0, 10));
var lastTime = currentTime - 365 * 24 * 60 * 60;
var push = setInterval(function() {
currentTime = parseInt(currentTime - 86400);
fs.writeFile('gitgreen.txt', currentTime, function(err) {
if (err) {
console.log('write failed!');
} else {
console.log('write succeed');
console.log(currentTime);
child_process.exec("git add .; GIT_AUTHOR_DATE='" + currentTime + "' GIT_COMMITTER_DATE='" + currentTime + "' git commit -m 'update'; git push origin master;", function(err, opt) {
if (err) throw err;
console.log("done!!");
})
}
})
}, 40000);
if (currentTime == lastTime) {
clearInterval(push);
console.log("finish!!!")
}