1
0
Fork 0
mirror of https://github.com/Sonarr/Sonarr synced 2024-12-23 08:15:27 +00:00

gulp getSonarr --branch=develop

This commit is contained in:
Keivan Beigi 2015-07-18 18:14:13 -07:00
parent 05dc68d689
commit 6682266cc9

View file

@ -23,14 +23,31 @@ function download(url, dest, cb) {
}
function getLatest(cb) {
var req = http.get('http://services.sonarr.tv/v1/update/develop?os=osx', function (response) {
response.on('data', function (data) {
var branch = 'develop';
process.argv.forEach(function (val) {
var branchMatch = /branch=([\S]*)/.exec(val);
if (branchMatch && branchMatch.length > 1) {
branch = branchMatch[1];
}
});
var url = 'http://services.sonarr.tv/v1/update/' + branch + '?os=osx';
console.log('Checking for latest version:', url);
http.get(url, function (res) {
var data = '';
res.on('data', function (chunk) {
data += chunk;
});
res.on('end', function () {
var updatePackage = JSON.parse(data).updatePackage;
console.log('Latest version avilable: ' + updatePackage.version + ' Release Date: ' + updatePackage.releaseDate);
console.log('Latest version available: ' + updatePackage.version + ' Release Date: ' + updatePackage.releaseDate);
cb(updatePackage);
});
});
req.on('error', function (e) {
}).on('error', function (e) {
console.log('problem with request: ' + e.message);
});
}