-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
31 lines (28 loc) · 826 Bytes
/
app.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
const yargs = require('yargs');
const axios = require('axios');
const fs = require('fs');
const argsOptions = require('./args.options.js');
const {Jobs} = require('./utils/jobs');
const argv = yargs
.command('build', 'build the remote jenkins job', {
path: argsOptions.pathOption
})
.help()
.alias('help', 'h')
.argv;
if(fs.existsSync(argv.path)) {
fs.readFile(argv.path, (err, data) => {
if(err) throw err;
var paths = data.toString().split(/\r?\n/);
var jobs = new Jobs();
var job = jobs.findJobByPath(data.toString());
if(!job) {
return;
}
axios.get(jobs.getUri(job)).then((response) => {
console.log('send request successfully');
}).catch((e) => {
console.log(e);
});
});
}