-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfetch.js
executable file
·73 lines (66 loc) · 1.51 KB
/
fetch.js
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
'use strict'
const fetchCommits = require('./tasks/fetchCommits')
const fetchPullRequests = require('./tasks/fetchPullRequests')
const fetchCommitDiffs = require('./tasks/fetchCommitDiffs')
const fetchUserEvents = require('./tasks/fetchUserEvents')
const fetchUserInfo = require('./tasks/fetchUserInfo')
const fetchIntegrators = require('./tasks/fetchIntegrators')
const computeHotness = require('./tasks/computeHotness')
const guessCommitPRRefs = require('./tasks/guessCommitPRRefs')
const setUsersId = require('./tasks/setUsersId')
const tasks = [
{
name: 'fetchCommits',
cb: fetchCommits
},
{
name: 'fetchPullRequests',
cb: fetchPullRequests
},
{
name: 'fetchCommitDiffs',
cb: fetchCommitDiffs
},
{
name: 'fetchUserEvents',
cb: fetchUserEvents
},
{
name: 'fetchUserInfo',
cb: fetchUserInfo
},
{
name: 'fetchIntegrators',
cb: fetchIntegrators
},
{
name: 'computeHotness',
cb: computeHotness
},
{
name: 'guessCommitPRRefs',
cb: guessCommitPRRefs
},
{
name: 'setUsersId',
cb: setUsersId
}
]
async function performTask (task, index, total) {
console.log(`#${index}/${total} - ${task.name}`)
if (task.cb) {
await task.cb(task)
}
}
function unhandledRejection (err) {
console.error(err)
process.exit(1)
}
async function main () {
process.on('unhandledRejection', unhandledRejection)
for (var index in tasks) {
const task = tasks[index]
await performTask(task, parseInt(index) + 1, tasks.length)
}
}
main()