Permalink
Browse files

[feature] progress bar

  • Loading branch information...
1 parent c834fdc commit e55feb1417eea414c962e5305c5961f11dc131b6 @yawnt yawnt committed Oct 17, 2012
Showing with 23 additions and 3 deletions.
  1. +17 −1 lib/jitsu/package.js
  2. +6 −2 package.json
View
@@ -17,6 +17,7 @@ var fs = require('fs'),
jitsu = require('../jitsu'),
ladder = require('ladder'),
fstream = require('fstream'),
+ ProgressBar = require('progress'),
fstreamNpm = require('fstream-npm'),
tar = require('tar');
@@ -419,10 +420,25 @@ package.updateTarball = function (version, pkg, existing, firstSnapshot, callbac
jitsu.log.warn('This is not recommended practice.');
}
- jitsu.snapshots.create(pkg.name, version, filename, function (err, snapshots) {
+ var fileStats = 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);
});
+
+ var bar = new ProgressBar('Uploading: [:bar] :percent',{
+ complete : '=',
+ incomplete: ' ',
+ width : 30 ,
+ total : fileStats.size
+ });
+
+ fileStats.emitter.on('data', function(data) {
+ bar.tick(data.length);
+ });
+
+ fileStats.emitter.on('end' , function(data) {
+ console.log('\n');
+ });
});
});
}
View
@@ -29,20 +29,24 @@
"fstream": "0.1.18",
"fstream-npm": "0.1.1",
"npm": "1.1.59",
- "nodejitsu-api": "0.3.3",
+ "nodejitsu-api": "0.3.x",
"pkginfo": "0.2.3",
"request": "2.11.0",
"require-analyzer": "0.4.0-3",
"spawn-command": "0.0.1",
"semver": "1.0.14",
"tar": "0.1.13",
"wizard": "0.0.1",
- "ladder": "0.0.0"
+ "ladder": "0.0.0",
+ "progress": "0.1.0"
},
"devDependencies": {
"nock": "0.8.x",
"vows": "0.6.x"
},
+ "bundledDependencies": [
+ "nodejitsu.api"
+ ],
"bin": {
"jitsu": "./bin/jitsu"
},

0 comments on commit e55feb1

Please sign in to comment.