Permalink
Browse files

Minor improvements to app download after building

  • Loading branch information...
1 parent 6b2140b commit 5b3d0bc55b61fa854f42219004c859eb53178cb9 Damian Beresford committed Feb 27, 2012
Showing with 5 additions and 6 deletions.
  1. +5 −6 lib/build.js
View
@@ -127,29 +127,27 @@ function doBuild(args, cb) {
function downloadBuild(args, asset_url, path, callback) {
if (args.download !== 'true') { return callback(); }
-
var host = url.parse(asset_url).hostname;
var filename = url.parse(asset_url).pathname.split("/").pop();
var theurl = http.createClient(80, host);
var requestUrl = asset_url;
- log.info("Downloading file: " + filename);
- log.info("Before download request");
+ log.info(filename, "Downloading file");
var request = theurl.request('GET', requestUrl, {"host": host});
request.end();
var bar = null;
var dlprogress = 0;
setInterval(function () {
- log.info("Download progress: " + dlprogress + " bytes");
+ log.info(dlprogress, "Download progress");
}, 1000);
request.addListener('response', function (response) {
var downloadfile = fs.createWriteStream(filename, {'flags': 'a'});
var filesize = parseInt(response.headers['content-length']);
- log.info("File size " + filename + ": " + filesize + " bytes.");
+ log.info(filesize, "File size " + filename);
response.addListener('data', function (chunk) {
dlprogress += chunk.length;
@@ -158,7 +156,8 @@ function downloadBuild(args, asset_url, path, callback) {
response.addListener("end", function() {
downloadfile.end();
- log.info("Finished downloading " + filename);
+ log.info(filename, "Finished downloading");
+ build.message = build.message + " \nFinished downloading: " + filename;
return callback();
});
});

0 comments on commit 5b3d0bc

Please sign in to comment.