2012-04-04 18:40:09 +00:00
|
|
|
var fs = require('fs'),
|
|
|
|
path = require('path'),
|
|
|
|
https = require('https');
|
2012-03-24 23:31:48 +00:00
|
|
|
|
|
|
|
var url = {
|
|
|
|
host: 'gerrit.wikimedia.org',
|
|
|
|
path: '/r/gitweb?p=mediawiki/core.git;a=blob_plain;hb=HEAD;f=tests/parser/parserTests.txt',
|
|
|
|
};
|
|
|
|
var target_name = __dirname+"/parserTests.txt";
|
|
|
|
|
|
|
|
var fetch = function(url, target_name) {
|
|
|
|
https.get(url, function(result) {
|
|
|
|
var out = fs.createWriteStream(target_name);
|
|
|
|
result.on('data', function(data) {
|
|
|
|
out.write(data);
|
|
|
|
});
|
|
|
|
result.on('end', function() {
|
|
|
|
if (out)
|
|
|
|
out.end();
|
|
|
|
});
|
|
|
|
}).on('error', function(err) {
|
|
|
|
console.error(err);
|
|
|
|
});
|
|
|
|
};
|
2012-04-04 18:40:09 +00:00
|
|
|
path.exists(target_name, function(exists) {
|
2012-03-24 23:31:48 +00:00
|
|
|
if (!exists) {
|
|
|
|
fetch(url, target_name);
|
|
|
|
}
|
|
|
|
});
|