Log warning if bundle not found

This commit is contained in:
Juan Cruz Viotti 2015-03-02 09:03:11 -04:00
parent 98b873d48d
commit 50ff40f6f3
2 changed files with 33 additions and 22 deletions

View File

@ -86,19 +86,25 @@
}
nodeDownload = function(destination, options, callback) {
return binary.download(options, destination, function(error, binaryPath) {
var output;
if (error != null) {
return callback(error);
}
output = path.join(destination, getNodeName(options));
return fs.rename(binaryPath, output, function(error) {
var error;
try {
return binary.download(options, destination, function(error, binaryPath) {
var output;
if (error != null) {
return callback(error);
}
return callback(null, output);
output = path.join(destination, getNodeName(options));
return fs.rename(binaryPath, output, function(error) {
if (error != null) {
return callback(error);
}
return callback(null, output);
});
});
});
} catch (_error) {
error = _error;
return callback(error);
}
};
async.eachLimit(bundles, 2, function(bundle, callback) {
@ -108,14 +114,15 @@
return callback(error);
}
console.info("Downloaded: " + (getNodeName(bundle)) + " to " + output);
return callback(null, output);
return callback();
});
}, function(error) {
if (error != null) {
console.error(error);
process.exit(1);
console.error(error.message);
return console.error('Error: Couldn\'t get the required node bundle. Omitting.');
} else {
return console.info('All NodeJS bundles downloaded');
}
return console.info('All NodeJS bundles downloaded');
});
}).call(this);

View File

@ -56,21 +56,25 @@ for bundle in bundles
console.info "- #{getNodeName(bundle)}"
nodeDownload = (destination, options, callback) ->
binary.download options, destination, (error, binaryPath) ->
return callback(error) if error?
output = path.join(destination, getNodeName(options))
fs.rename binaryPath, output, (error) ->
try
binary.download options, destination, (error, binaryPath) ->
return callback(error) if error?
return callback(null, output)
output = path.join(destination, getNodeName(options))
fs.rename binaryPath, output, (error) ->
return callback(error) if error?
return callback(null, output)
catch error
return callback(error)
async.eachLimit bundles, 2, (bundle, callback) ->
console.info("Downloading: #{getNodeName(bundle)} to #{DESTINATION}")
return nodeDownload DESTINATION, bundle, (error, output) ->
return callback(error) if error?
console.info("Downloaded: #{getNodeName(bundle)} to #{output}")
return callback(null, output)
return callback()
, (error) ->
if error?
console.error(error)
process.exit(1)
console.info('All NodeJS bundles downloaded')
console.error(error.message)
console.error('Error: Couldn\'t get the required node bundle. Omitting.')
else
console.info('All NodeJS bundles downloaded')