1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-05 02:22:31 +01: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) { function getLatest(cb) {
var req = http.get('http://services.sonarr.tv/v1/update/develop?os=osx', function (response) { var branch = 'develop';
response.on('data', function (data) { 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; 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); cb(updatePackage);
}); });
}); }).on('error', function (e) {
req.on('error', function (e) {
console.log('problem with request: ' + e.message); console.log('problem with request: ' + e.message);
}); });
} }