1 | #!/usr/bin/env node
|
2 |
|
3 | var request = require('request')
|
4 | , path = require('path')
|
5 | , fs = require('fs');
|
6 |
|
7 | var files = {
|
8 | 'pgts.yaml': 'https://raw.github.com/tobie/ua-parser/master/test_resources/pgts_browser_list.yaml'
|
9 | , 'testcases.yaml': 'https://raw.github.com/tobie/ua-parser/master/test_resources/test_user_agent_parser.yaml'
|
10 | , 'firefoxes.yaml': 'https://raw.github.com/tobie/ua-parser/master/test_resources/firefox_user_agent_strings.yaml'
|
11 | };
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | Object.keys(files).forEach(function (key) {
|
18 | request(files[key], function response (err, res, data) {
|
19 | if (err || res.statusCode !== 200) return console.error('failed to update');
|
20 |
|
21 | console.log('downloaded', files[key]);
|
22 | fs.writeFileSync(path.join(__dirname, '..', 'tests', 'fixtures', key), data);
|
23 | });
|
24 | });
|