-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
84 lines (76 loc) · 3.39 KB
/
index.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
74
75
76
77
78
79
80
81
82
83
84
var exec = require('child-process-promise').exec;
let date_ob = new Date();
let date = ("0" + date_ob.getDate()).slice(-2);
let month = ("0" + (date_ob.getMonth() + 1)).slice(-2);
let year = date_ob.getFullYear();
let today = year + "-" + month + "-" + date
console.log(`• Making "${today}" in "/data" Directory`)
exec(`mkdir ${__dirname}/data/${today}`, {maxBuffer: 1024 * 2000})
.then(function(result) {
var stdout = result.stdout;
var stderr = result.stderr;
console.log(stdout);
console.log(stderr);
exec(`mkdir ${__dirname}/data/${today}/mbta`, {maxBuffer: 1024 * 2000})
exec(`mkdir ${__dirname}/data/${today}/mbta/routes`, {maxBuffer: 1024 * 2000})
exec(`mkdir ${__dirname}/data/${today}/mta`, {maxBuffer: 1024 * 2000})
exec(`mkdir ${__dirname}/data/${today}/mta/routes`, {maxBuffer: 1024 * 2000})
exec(`mkdir ${__dirname}/data/${today}/rta`, {maxBuffer: 1024 * 2000})
exec(`mkdir ${__dirname}/data/${today}/rta/routes`, {maxBuffer: 1024 * 2000})
})
.catch(function(err) {
console.log('---------------------------------------------------------');
console.error('ERROR: ', err);
console.log('---------------------------------------------------------');
});
console.log(`• Importing GTFS data for MBTA in Massachusetts`)
exec(`gtfs-import --configPath ${__dirname}/config/ma/mbta.json`, {maxBuffer: 1024 * 2000})
.then(function(result) {
var stdout = result.stdout;
var stderr = result.stderr;
//console.log(stdout);
//console.log(stderr);
console.log(`• Formatting GTFS data for MBTA in Massachusetts`)
exec(`node config/ma/mbta.js`, {maxBuffer: 1024 * 2000})
})
.catch(function(err) {
console.log('---------------------------------------------------------');
console.error('ERROR: ', err);
console.log('---------------------------------------------------------');
console.log(`• Formatting GTFS data for MBTA in Massachusetts`)
exec(`node config/ma/mbta.js`, {maxBuffer: 1024 * 2000})
});
console.log(`• Importing GTFS data for MTA in New York`)
exec(`gtfs-import --configPath ${__dirname}/config/ny/mta.json`, {maxBuffer: 1024 * 2000})
.then(function(result) {
var stdout = result.stdout;
var stderr = result.stderr;
//console.log(stdout);
//console.log(stderr);
console.log(`• Formatting GTFS data for MTA in New York`)
exec(`node config/ny/mta.js`, {maxBuffer: 1024 * 2000})
})
.catch(function(err) {
console.log('---------------------------------------------------------');
console.error('ERROR: ', err);
console.log('---------------------------------------------------------');
console.log(`• Formatting GTFS data for MTA in New York`)
exec(`node config/ny/mta.js`, {maxBuffer: 1024 * 2000})
});
console.log(`• Importing GTFS data for RTA in Dayton, Ohio`)
exec(`gtfs-import --configPath ${__dirname}/config/oh/rta.json`, {maxBuffer: 1024 * 2000})
.then(function(result) {
var stdout = result.stdout;
var stderr = result.stderr;
//console.log(stdout);
//console.log(stderr);
console.log(`• Formatting GTFS data for RTA in Dayton, Ohio`)
exec(`node config/oh/rta.js`, {maxBuffer: 1024 * 2000})
})
.catch(function(err) {
console.log('---------------------------------------------------------');
console.error('ERROR: ', err);
console.log('---------------------------------------------------------');
console.log(`• Formatting GTFS data for RTA in Dayton, Ohio`)
exec(`node config/oh/rta.js`, {maxBuffer: 1024 * 2000})
});