-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathscorePoster.js
50 lines (41 loc) · 1.13 KB
/
scorePoster.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
const request = require('request');
const rp = require('request-promise');
const syncRequest = require('sync-request');
function scorePoster(passes, cb) {
const repo = process.argv[process.argv.length - 1];
const github = process.argv[process.argv.length - 2];
const options = {
method: 'POST',
uri: 'http://35.173.188.239:3000/api/updateone',
body: {
score: passes,
repo,
github
},
json: true // Automatically stringifies the body to JSON
};
if (passes > 0) {
console.log('yay', options.body)
// rp(options)
// .then(function (parsedBody) {
// // POST succeeded...
// console.log('sending', options.body)
// console.log(parsedBody)
// })
// .catch(function (err) {
// console.log('lol you done failed', err)
// process.exit(failures);
// })
// .finally(function() {
// if (cb) {
// cb();
// }
// })
// using syncRequest cause Jasmine broke asnyc reporters
syncRequest('POST', 'http://35.173.188.239:3000/api/updateone', {json: options.body} )
if (cb) {
cb()
}
};
};
module.exports = scorePoster