Skip to content
Permalink
Browse files

[api] removed progressbar from row output #356

  • Loading branch information...
blakmatrix committed Nov 10, 2012
1 parent 723c6f5 commit 2d11c97b23fb7696ded2bf68359d589f1ad86bb5
Showing with 33 additions and 24 deletions.
  1. +33 −24 lib/jitsu/package.js
@@ -422,36 +422,45 @@ package.updateTarball = function (version, pkg, existing, firstSnapshot, callbac
jitsu.log.warn('This is not recommended practice.');
}

var emitter = jitsu.snapshots.create(pkg.name, version, filename, function (err, snapshots) {
jitsu.log.silly('Done creating snapshot ' + version.magenta);
return err ? callback(err) : callback(null, version, pkg);
});

if(emitter) {
var size;
emitter.on('start', function(stats) {
size = stats.size;
bar = new ProgressBar('info'.green + '\t Uploading: [:bar] :percent',{
complete : '=',
incomplete: ' ',
width : 30 ,
total : stats.size
});
if(!jitsu.config.get('raw')) {
var emitter = jitsu.snapshots.create(pkg.name, version, filename, function (err, snapshots) {
jitsu.log.silly('Done creating snapshot ' + version.magenta);
return err ? callback(err) : callback(null, version, pkg);
});

if(emitter) {
var size;
emitter.on('start', function(stats) {
size = stats.size;
bar = new ProgressBar('info'.green + '\t Uploading: [:bar] :percent',{
complete : '=',
incomplete: ' ',
width : 30 ,
total : stats.size
});
});

emitter.on('data', function(length) {
if(bar) bar.tick(length > size ? size : length);
});
emitter.on('data', function(length) {
if(bar) { bar.tick(length > size ? size : length); }
});

emitter.on('end', function() {
// fix for bar that sometimes hangs at 99%
if(bar) {
bar.tick(bar.total - bar.curr);
}
emitter.on('end', function() {
// fix for bar that sometimes hangs at 99%
if(bar) {
bar.tick(bar.total - bar.curr);
}

console.log();
console.log();
});
}

} else {
jitsu.snapshots.create(pkg.name, version, filename, function (err, snapshots) {
jitsu.log.silly('Done creating snapshot ' + version.magenta);
return err ? callback(err) : callback(null, version, pkg);
});
}

});
});
}

0 comments on commit 2d11c97

Please sign in to comment.
You can’t perform that action at this time.