@@ -12,6 +12,7 @@ process.title = "dxwcmdesigns";
1212var argv ;
1313var utils = require ( './lib/utils' ) ;
1414var logger = utils . debugLogger ;
15+ var curCount = 0 ;
1516utils . debugLogger = function ( name ) {
1617
1718 var lg = logger ( name ) . log ;
@@ -213,15 +214,13 @@ var chooseLibraries = function(settings) {
213214 */
214215var getLibrary = function ( libraries , lib , settings ) {
215216 console . log ( "Downloading '" + libraries [ lib ] . title + "' ..." ) ;
216- setTimeout ( printProgress , 80 ) ;
217- wcmHelper . pullLibrary ( libraries [ lib ] . title , { includeMeta : false , filterComponentId : true } ) . then ( function ( ) {
217+ wcmHelper . pullLibrary ( libraries [ lib ] . title , { includeMeta : false , filterComponentId : true } ) . then ( function ( ) {
218218 for ( var k in libraries [ lib ] ) {
219219 settings [ k ] = libraries [ lib ] [ k ] ;
220220 }
221221 fs . writeFile ( cwd + "/" + libraries [ lib ] . title + "/.settings" , JSON . stringify ( settings , null , ' ' ) , function ( ) {
222- printProgress ( 0 , 1 ) ;
223- commandDone = true ;
224- console . log ( "done!" ) ;
222+ console . log ( ' Pulled ' + curCount + " item(s) from library " + libraries [ lib ] . title ) ;
223+ curCount = 0 ;
225224 printDir ( cwd + "/" + libraries [ lib ] . title ) ;
226225 } ) ;
227226 } , function ( err ) {
@@ -246,11 +245,11 @@ var push = function(tries) {
246245 var settings = JSON . parse ( data . toString ( ) ) ;
247246
248247 if ( settings . title ) {
249- console . log ( "in progress ..." ) ;
250- setTimeout ( printProgress . bind ( global , 80 ) , 100 ) ;
248+ console . log ( "Pushing to library " + settings . title + " in progress ..." ) ;
251249 initWcmHelper ( settings , path . dirname ( path . normalize ( cwd ) ) ) . then ( function ( ) {
252250 wcmHelper . pushLibrary ( settings . title , argv . all ? true : false ) . then ( function ( ) {
253- console . log ( "done!" ) ;
251+ console . log ( ' Pushed ' + curCount + " item(s) to library " + settings . title ) ;
252+ curCount = 0 ;
254253 } , function ( err ) {
255254 console . error ( "Error: " + err . message ) ;
256255 } ) ;
@@ -277,14 +276,13 @@ var pull = function(tries) {
277276 } else {
278277 var settings = JSON . parse ( data . toString ( ) ) ;
279278 if ( settings . title ) {
280- console . log ( " in progress ..." ) ;
281- setTimeout ( printProgress . bind ( global , 80 ) , 80 ) ;
279+ console . log ( 'Pulling from library ' + settings . title + ' in progress ...' ) ;
280+
282281 initWcmHelper ( settings , path . dirname ( path . normalize ( cwd ) ) ) . then ( function ( ) {
283282 wcmHelper . pullLibrary ( settings . title , { includeMeta : false , filterComponentId : true } )
284283 . then ( function ( ) {
285- printProgress ( 0 , 1 ) ;
286- commandDone = true ;
287- console . log ( "done!" ) ;
284+ console . log ( ' Pulled ' + curCount + " item(s) from library " + settings . title ) ;
285+ curCount = 0 ;
288286 } , function ( err ) {
289287 console . error ( "Error: " + err . message ) ;
290288 } ) ;
@@ -363,22 +361,20 @@ function getInitPromptSchema(settings) {
363361} ;
364362
365363var eventEmitter = wcmHelper . getEventEmitter ( ) ;
366- if ( argv . v ) {
367364 eventEmitter . on ( "pushed" , function ( libName , itemToPush ) {
368- clearConsole ( ) ;
369- console . log ( "pushed: " + itemToPush . name + ", " + path . relative ( cwd , itemToPush . file ) ) ;
365+ curCount ++ ;
366+ console . log ( "pushed: " + itemToPush . file ) ;
370367 } ) ;
371368
372369 eventEmitter . on ( "pulled" , function ( libName , type , entry , path , extension ) {
373- clearConsole ( ) ;
370+ curCount ++ ;
374371 console . log ( "pulled: " + path + extension ) ;
375372 } ) ;
376373
377374 eventEmitter . on ( "pullingType" , function ( libName , type ) {
378- clearConsole ( ) ;
379375 console . log ( "pulling type: " + type ) ;
380376 } ) ;
381- }
377+
382378eventEmitter . on ( "error" , function ( err , msg ) {
383379 clearConsole ( ) ;
384380 console . log ( "ERROR" ) ;
@@ -435,35 +431,6 @@ function copyObjectProperties(source, dest) {
435431 }
436432}
437433
438- function printProgress ( timeout , progress ) {
439- if ( commandDone ) {
440- return ;
441- }
442-
443- try {
444- var width = 72 ; // width of progress bar
445- if ( typeof progress === 'undefined' ) {
446- progress = wcmHelper . getProgress ( ) ;
447- }
448- clearConsole ( ) ;
449-
450- var limit = Math . round ( progress * width ) ;
451- for ( var i = 0 ; i < limit ; i ++ ) {
452- process . stdout . write ( "=" )
453- }
454- for ( var i = limit ; i < width ; i ++ ) {
455- process . stdout . write ( "-" )
456- }
457- process . stdout . write ( " " + ( 100 * progress ) . toFixed ( 2 ) + "%" ) ;
458-
459- if ( progress == 1 ) {
460- console . log ( ) ;
461- } else if ( timeout || timeout === 0 ) {
462- setTimeout ( printProgress . bind ( null , timeout ) , timeout ) ;
463- }
464- } catch ( e ) { }
465- }
466-
467434function clearConsole ( ) {
468435 process . stdout . clearLine ( ) ;
469436 process . stdout . cursorTo ( 0 ) ;
0 commit comments