function(err) {
     if (err) {
         console.log(chalk.red.underline('Error in processing ', doc.id, 'of', collection));
         console.log(chalk.red.underline('This has stopped the process '));
     }
     eachDocumentCallback();
 });
 function(err) {
     if (err) {
         console.log(chalk.red.underline('Error in processing ', collection));
         console.log(chalk.red.underline('This has stopped the process '));
     } else {
         console.log(chalk.green(collection, 'processed fine '));
     }
     eachCollectionCallback();
 });
示例#3
0
 exec('./node_modules/.bin/flow', function(error, stdout) {
     var lines = stdout.split('\n');
     var fileRegexp = /^src.*\.jsx?\:[\d]*/;
     var sumRegexpErr = /Found [\d]* error/;
     var sumRegexpOk = /No errors/;
     var pointerRegexp = /\^/;
     for (var i = 0; i < lines.length; i++) {
         var line = lines[i];
         if (fileRegexp.test(line)) {
             console.log(chalk.red.underline(line));
         } else if (pointerRegexp.test(line)) {
             var start = line.indexOf('\^');
             var end = line.lastIndexOf('\^');
             console.log(
                 line.slice(0, start) + chalk.yellow(line.slice(start, end + 1)) + line.slice(end + 1)
             );
         } else if (sumRegexpErr.test(line)) {
             console.log(chalk.white.bold.underline('TypeCheck:') + ' ' + chalk.red.bold(line));
         } else if (sumRegexpOk.test(line)) {
             console.log(chalk.white.bold.underline('TypeCheck:') + ' ' + chalk.green.bold(line));
         } else {
             console.log(chalk.white(line));
         }
     }
     if (!noErrors && error) {
         cb(error);
     } else {
         cb();
     }
 });
var main = function(err, doc, collection, process) {

    // if any of the file processing produced an error, err would equal that error
    if (err) {
        // One of the iterations produced an error.
        // All processing will now stop.
        console.log(chalk.red.underline('Error in processing', process, 'this has stopped the process'));
    } else {
        console.log(chalk.bgGreen('all transfers done successfully'));
        // If no errors.
    }
    console.log('');
};
示例#5
0
Generator.prototype.welcome = function welcome() {
	if (!this.options['skip-welcome-message']) {

		this.log(yosay(
			'Welcome to ' + chalk.red('ng-gulp') + '!'
		));

		this.log(
			'Let me guide you down the path of ' +
			chalk.red.underline('awesomeness') + '\n\n'
		);
	}
};
示例#6
0
 .then(function (res) {
   
   var build = res.body;
   
   // Any other error
   if (build.status || build.error) {
     return status.emit('error', res.body.error);
   }
   
   // Unexptected error
   if (!build.loadpoint) {
     var errorMsg = '';
     errorMsg += 'Unexpected build data.\n';
     errorMsg += format.red.underline('====== Build Data Start ======\n');
     errorMsg += JSON.stringify(build, null, 4) + '\n';
     errorMsg += format.red.underline('====== Build Data End ======\n');
     errorMsg += '\nContact support@divshot.com with this data for diagnostic purposes.';
     
     return status.emit('error', errorMsg);
   }
   
   status.emit('build:end', build);
   startUpload(config, build);
 })
示例#7
0
文件: help.js 项目: langgo/lsxo
function printAllHelp(obj) {
    var keys = Object.keys(obj);
    var cmds = [];
    for (var key of keys) {
        cmds.push({
            name: key,
            desc: list[key].options.desc
        })
    }

    console.log(chalk.blue('Usage:') + ' lsxo <command>');
    console.log('\n');

    printList('Commands', cmds);

    printList('Global Options', [
        {name: '--debug', desc: ''}
    ]);

    console.log(chalk.red('For more help, you can use \'lsxo help [command]\' for the detailed information'));
    console.log(chalk.red('or you can check the docs:'), chalk.red.underline('http://lsxo.io/docs/'));
}
示例#8
0
 it('should render description with red and underline', () => {
   theme.renderMainDescription('text')
     .should.equal(
       chalk.red.underline('text'));
 });
示例#9
0
文件: test-ylog.js 项目: qiu8310/ylog
 testOut(function() {
   ylog.wrap(3).log(chalk.red.underline('are') + chalk.green('youok!'))
 }, '\nare\nyou\nok!', {trim: false});
示例#10
0
文件: logrw.js 项目: jamime/logrw
Logrw.prototype.critical = function () {
    'use strict';
    this._print(chalk.red.underline('CRITICAL'), arguments)
};
示例#11
0
      .onUpload('retry', function (err) {

        console.log('\n' + format.red.underline(err.message));
        console.log(format.green.underline('Retrying...'));
      });
示例#12
0
 it('should render description with red and underline', function () {
   theme.renderDescription('text')
     .should.equal(
       chalk.red.underline('text'));
 });
示例#13
0
     cli.api.apps.id(config.name).builds.create({config: config}, function(err, build){
       if (err) return onError(err);
       
       // App doesn't exist, create it
       if (build && build.status == 404) return createAppBeforeBuild(config);
       
       // Not allowed
       if (build && build.status == 401) return onError(build);
       
       // Any other error
       if (build && build.status) return onError(err);
       
       if (!build.loadpoint) {
         cli.log('Unexpected build data.');
         cli.log(format.red.underline('---Build Data Start---'));
         cli.log(JSON.stringify(build, null, 4));
         cli.log(format.red.underline('---Build Data End---'));
         return done('Contact support@divshot.com with this data for diagnostic purposes.')
       }
 
       cli.log(format.green('✔'));
       cli.log('');
      
       tmp.dir({unsafeCleanup: true}, function(err, tmpDir) {
         async.map(filesToUpload, function(src, callback){
 	        // This seems to be the main place path seperators are getting us into trouble.
 	        var _appRootDir = appRootDir.replace(/\\/g, '/');
 	        src = src.replace(/\\/g, '/');
 
           if (fs.statSync(src).isDirectory()) { callback(); return; };
           var dest = src.replace(_appRootDir, tmpDir + "/" + build.id).replace(/\\/g, '/');
           fs.ensureFileSync(dest);
           fs.copySync(src, dest);
 	        callback()  
 	      }, function() {
 
           // 5. get the STS token for the build formatted for our S3 lib
           var authorization = JSON.parse(new Buffer(build.loadpoint.authorization, 'base64'));
 
           // 6. upload files syncTree
           var directory = [tmpDir, build.id].join('/');
           var syncTree = require('../helpers/sync_tree');
           var sync = syncTree({
             clientOptions: {
               secretAccessKey: authorization.secret,
               accessKeyId: authorization.key,
               sessionToken: authorization.token,
               region: 'us-east-1',
               httpOptions: {
                 timeout: 1500
               }
             },
             directory: [tmpDir, build.id].join('/'),
             bucket: process.env.DIVSHOT_HASHED_BUCKET,
             prefix: build.application_id
           });
 
           var inodeCount;
           var visitedCount = 0;
 
           var format = require('chalk');
           var progressBar;
           var ProgressBar = require('progress');
 
           function verbose() {
             // console.log.apply(console, arguments);
           }
 
           process.stdout.write('Hashing Directory Contents ...');
 
           sync.on('inodecount', function(count) {
             process.stdout.write(format.green(' ✔\n'));
             progressBar = new ProgressBar('Syncing '+ count +' inodes: [' + format.green(':bar') + '] ' + format.bold(':percent') + '', {
               complete: '=',
               incomplete: ' ',
               width: 50,
               total: count
             });
             inodeCount = count;
           });
 
           sync.on('notfound', function(path, hash) {
             verbose(format.red('404 ') + path);
           });
 
           sync.on('found', function(path, hash, count) {
             verbose(format.green('200 ') + path)
             visitedCount += count;
             progressBar.tick(count);
           });
 
           sync.on('cachestart', function(path, hash) {
             verbose(format.blue('PUT ') + path)
           });
 
           sync.on('cachesuccess', function(path, hash, count) {
             verbose(format.green('201 ') + path);
             visitedCount += 1;
             progressBar.tick(1);
           });
 
           sync.on('uploadstart', function(path, hash) {
             verbose(format.blue('PUT ') + path);
           });
 
           sync.on('uploadsuccess', function(path, hash) {
             verbose(format.green('201 ') + path);
             visitedCount += 1;
             progressBar.tick(1);
           });
 
           sync.on('uploadfailure', function(error) {
           });
 
           sync.on('retry', function(error) {
             visitedCount = 0;
             cli.log('');
             cli.log(format.red.underline(error.message));
             cli.log(format.green.underline('Retrying...'))
           });
 
           sync.on('error', function(error) {
             cli.log('');
             cli.log(format.red.underline(error.message));
             cli.log(error.stack);
             process.exit(1);
           });
 
           sync.on('synced', function(fileMap) {
             cli.log(format.green('Synced!'));
             verbose('inodeCount: ' + inodeCount, 'visitedCount: ' + visitedCount);
 
             var buildApi = cli.api.apps.id(config.name).builds.id(build.id);
             cli.log('');
             process.stdout.write('Finalizing build ... ');
 
             var url = buildApi.url() + '/finalize';
 
 
             // console.log(url, buildApi.http.request.toString());
             // console.log(fileMap);
             // process.exit(1);
             buildApi.http.request(url, 'PUT', {json:{file_map: fileMap}}, function (err, response) {
               if (err) return done('error', err);
               if (response.statusCode < 200 || response.statusCode >= 300) {
                 var res = {};
 
                 try {res = JSON.parse(response.body);}
                 catch (e) {}
                 
                 cli.log();
                 return done(res.error);
               }
 
               cli.log(format.green('✔'));
               process.stdout.write('Releasing build to ' + format.bold(environment) + ' ... ');
 
               buildApi.release(environment, function (err, response) {
                 if (err) return done(err);
                 cli.log(format.green('✔'));
                 
                 return onPushed();
               });
             });
 
           });
         });
       });
     });
示例#14
0
 sync.on('error', function(error) {
   cli.log('');
   cli.log(format.red.underline(error.message));
   cli.log(error.stack);
   process.exit(1);
 });
示例#15
0
 sync.on('retry', function(error) {
   visitedCount = 0;
   cli.log('');
   cli.log(format.red.underline(error.message));
   cli.log(format.green.underline('Retrying...'))
 });