Пример #1
0
function printHello() {
  console.log('\n');
  console.log('  ' + chalk.bgBlue('     ') + chalk.bgCyan('                   ') + chalk.bgGreen('     '));
  console.log('  ' + chalk.bgBlue('     ') + chalk.bgCyan('                   ') + chalk.bgGreen('     '));
  console.log('  ' + chalk.bgBlue('     ') + chalk.bold.black.bgWhite('                   ') + chalk.bgYellow('     '));
  console.log('  ' + chalk.bgBlue('     ') + chalk.bold.black.bgWhite(' Luxafor for Slack ') + chalk.bgYellow('     '));
  console.log('  ' + chalk.bgBlue('     ') + chalk.bold.black.bgWhite('                   ') + chalk.bgYellow('     '));
  console.log('  ' + chalk.bgMagenta('     ') + chalk.bgRed('                        '));
  console.log('  ' + chalk.bgMagenta('     ') + chalk.bgRed('                        '));
  console.log('\n');
}
Пример #2
0
util.logEnv = function() {
    var project = require('../../package.json');

    var msg = [
        chalk.bold(project.name),
        chalk.inverse(ENV)
    ];

    if(util.isWatching) {
        msg.push(chalk.bgMagenta('WATCHING'));
    }
    if(util.isParallel) {
        msg.push(chalk.bgBlue('PARALLEL BUILD'));
    }
    if(util.isSmart) {
        msg.push(chalk.bgBlue('SMART BUILD'));
    }
    if(util.isSpeedy) {
        msg.push(chalk.bgRed('SPEEDY BUILD'));
    }
    if(util.ignoreErrors) {
        msg.push(chalk.bgRed('IGNORE ERRORS'));
    }

    util.log(msg.join(' | '));
};
Пример #3
0
function theScrape(civiToNb) {
  var casperCmd = 'casperjs --engine=slimerjs' 
	          + ' --userEmail=' + userEmail 
	          + ' --userPass='******' emsScraper.js';
  console.log(chalk.bgMagenta('===> calling: casperjs --engine=slimerjs emsScraper.js'));
  exec(casperCmd, {}, function (err, stdout, stderr) {
    var combinedScrape = [];
    if (err) throw err; 
    console.log('in callback');
    console.log(stdout);

    //TODO: no assumption that scrape went all good.
    //want to read all .txt files in and separate each with a ',' and push to a combined
    fs.readdir(process.cwd() + '/scrapes', function (err, files) {
      if (err) throw err; 
      //console.log('===> individual scraped files in /scrapes:');
      //console.dir(files);
      _.forEach(files, function (file) {
        var data = fs.readFileSync('scrapes/' + file, {encoding:'utf-8'});
	var pData = JSON.parse(data);
	combinedScrape.push(pData);
      });
      var tScrapes = _.flatten(combinedScrape);
      console.log('tScrapes.length: ' + tScrapes.length);
      var sFile = 'tastyScrapes.txt';
      fs.writeFile(sFile, JSON.stringify(tScrapes), function (err) {
        if (err) throw err; 
	console.log('successfully saved tastyScrapes.txt');
        theExtraction(civiToNb);	
      });
    });
  }); 
}
Пример #4
0
export const debug = (text, title = 'debug') => {
    const output = `${chalk.gray('binge')} ${chalk.bgMagenta(title)} ${text}`
    if (bar) {
        bar.interrupt(output)
    } else {
        console.log(output)
    }
}
Пример #5
0
 urls.forEach(function(item) {
   //console.log(item); //debugging
   //color the various parts of the URL
   var colored = chalk.bgBlue.white(item.protocol) + chalk.bgWhite.black("//");
   colored += chalk.bgRed(item.host);
   colored += chalk.bgMagenta(item.path);
   //print the colored URL to standard output
   console.log(colored);
 }); //end forEach
Пример #6
0
 messages.forEach(function (message, index) {
   if (!displayedMessages[message]) {
     displayedMessages[message] = true;
     if (index % 2 === 0) {
       console.log('\n' + chalk.bgMagenta(message));
     } else {
       console.log(message);
     }
   }
 });
Пример #7
0
		Ftp.put(src, file, function(hadError) {
			if (!hadError){
				grunt.log.writeln(chalk.bgMagenta(file+" file transferred successfully!"));
				i++;
				callback(files);			
			}else{
				grunt.log.writeln(chalk.red(hadError));
				sendFile(src, file, callback);
				return false;				
			}
		});
Пример #8
0
	log: function(text, level) {
		switch(level) {
			case -1:
			console.log(chalk.bgRed(text));
			break;
		case -1:
			console.log(chalk.bgRed(text));
			break;
		case 0:
			console.log(text);
			break;
		case 1:
			console.log(chalk.yellow(text));
			break;
		case 2:
			console.log(chalk.cyan(text));
			break;
		case 3:
			console.log(chalk.bgMagenta(text));
			break;
		}
	}
Пример #9
0
 bot.on('alert', function(message){
   log(chalk.bgMagenta('ALERT -- ALERT -- ALERT'));
   log(chalk.magenta(message));
 });
Пример #10
0
    console.log(chalk.white.bgCyan.bold("placement strategy report"));
    console.log(chalk.cyan("\tclient slices"));
    clientfs.map(function (r) {
        console.log("\t - " + r);
    });
    console.log(chalk.cyan("\tserver slices"));
    serverfs.map(function (r) {
        console.log("\t - " + r);
    });
    clientperc = clientfs.length / (clientfs.length + serverfs.length);
    serverperc = serverfs.length / (clientfs.length + serverfs.length);
    var chart = chalk.bold("\n \t 0% [ ");
    var drawClient = Math.round(clientperc * 10);
    for (var i = 0; i < 10; i++) {
        if (i <= drawClient)
            chart += chalk.bgMagenta("  ");
        else
            chart += chalk.bgGreen("  ");

    }
    chart += chalk.bold(" ] 100% \n");
    chart += "\t" + chalk.bgMagenta(" ") + " = client\n";
    chart += "\t" + chalk.bgGreen(" ") + " = server\n";
    console.log(chart);

    console.log("\tApplication level of offline availability: " +  chalk.blue(Math.floor(result.placementinfo.fitness * 100) + "%"));

    PDG.getFunctionalityNodes().forEach(function (n) {
        var advice = Advice.advice(n, PDG);
        if (!advice.placement) {
            if (advice.calls.length > 0) {
Пример #11
0
gulp.task('webpack', function(cb){
  var serverConfig = getServerConfig()

  /* If not production, and serverConfig exists, allow the webpack-dev-server to build, host and source-map its own webpack_build.js on localhost:<dev_server_config.port>
   * (will not appear in the local filesystem) to enable hot module loading and building single file changes for any changes to js files */
  if (!isProduction() && serverConfig){
    try {
      exec(deleteFile('build/js/webpack_build.js'), function(){})
      /* The below line is meant to trap the cmd+c command and ensure the webpack-dev-server stops, since it intermittently has issues. Comment out for now unless needed: */
      //exec('bash -c "trap \'exec bash\' SIGINT; node_modules/.bin/webpack-dev-server;"')
    }
    catch(e) {
      /* If the delete function returns an error, that's okay! Probably because it doesn't exist.
       * We want no local file to exist for the webpack_build when running the dev server, since the dev
       * server creates its own that it hosts and source-maps for localhost based on the given filename.
       * Having a local version conflicting with the server's version may cause issues. */
    }

    progressMessage = chalk.cyan.bold('Starting dev-server and bundling dependencies:') + ' ' + chalk.bgMagenta('[:bar]') + ' ' + chalk.magenta.bold(':percent') + ' Running for :elapsed seconds'
    webpackConfig = getWebpackConfig(serverConfig, progressMessage)

    var compiler = webpack(webpackConfig)
    var initialCompile = true

    var devServer = new webpackDevServer(compiler, {
      hot: true,
      historyApiFallback: { // Always serve up index.html for all urls.
        index: 'index.html'
      },
      stats: {
        hash: false,
        version: false,
        timings: false,
        assets: false,
        chunks: false,
        modules: false,
        reasons: false,
        children: false,
        source: false,
        errors: true,
        errorDetails: true,
        warnings: false,
        publicPath: false
      },
      noInfo: true,
      filename: 'build/js/webpack_build.js',
      publicPath: webpackConfig.output.publicPath

    }).listen(serverConfig.port, function(err){
      if (err) cb(err)
    })

    compiler.plugin('done', stats => {
      if (initialCompile){
        initialCompile = false;
        var hasErrors = stats.compilation.errors && stats.compilation.errors.length;
        var message = "Listening to webpack dev server on " + serverConfig.origin + ":" + serverConfig.port + "\n";

        if (hasErrors) {
          /* Don't use callback to throw error, since that will stop the process.
           * Initial compiles with webpack dev server should go through regardless of success, so that the errors can be fixed without having to re-run from scratch. */
          console.log(stats.compilation.errors[0].message);
          gutil.log(chalk.red("PENDING ERRORS: " + message));
        }
        else {
          gutil.log(chalk.magenta(message));
        }

        cb();
      }
    })
  }
  /* If no serverConfig is found, build the webpack_build file in the local filesystem using webpack-stream */
  else {
    var progressMessage = chalk.cyan.bold('Bundling all your hard work:') + ' ' + chalk.bgMagenta('[:bar]') + ' ' + chalk.magenta.bold(':percent') + ' Running for :elapsed seconds'
    var webpackConfig = getWebpackConfig(null, progressMessage)

    return gulp.src('./js/app/application.js')
      .pipe(webpackStream(webpackConfig))
      .on('error', function(err) {
        cb(err)
        return process.exit(1)
      })
      .pipe(gulp.dest('./build/js/'))
  }
})
Пример #12
0
    console.log(chalk.bgWhite(chalk.black('node manage.js --generate-token --_id <_id here>')));
    console.log('or');
    console.log(chalk.bgWhite(chalk.black('node manage.js --generate-token --id <_id here>')));
    console.log('or');
    console.log(chalk.bgWhite(chalk.black('node manage.js --generate-token --create')));
  } else {
    console.log(chalk.green('Generating a new token for device: {device}'.replace('{device}', _id)));

    /**
     * TODO: Handle non existant _ids
     */

    var _token = auth.signToken({deviceId: _id});
    console.log(chalk.green('Token generated:'));
    console.log('\n');
    console.log(chalk.bgMagenta(_token));
    console.log('\n');
  }

}

if (options.hasOwnProperty('secret')) {
  console.log(chalk.green('Generating new secret:'));
  var _secret = auth.uuid(64);
  console.log(chalk.bgMagenta(_secret));

  if (options.hasOwnProperty('save')) {
    var _envPath  = path.resolve('.env');
    if (fs.existsSync(_envPath)) {
      var _fileContent = fs.readFileSync(_envPath, 'utf8');
Пример #13
0
    ip         = require("ip")
    jsonwt     = require("jsonwebtoken"),
    md5        = require("MD5"),
    mime       = require("mime"),
    peer       = require("peer"),
    socketJwt  = require("socketio-jwt"),
    url        = require("url"),
    User       = require("./User.js"),
    Users      = require("./Users.js"),

    app = express(),
    _users = new Users();

Log.i( chalk.green("Dependencias cargadas") )
   .i( chalk.yellow("Cargando archivo de configuración… ") +
       chalk.bgMagenta("(") +
       chalk.bgYellow("seetings.json") +
       chalk.bgMagenta(")")
     );

/*
 * Loading configuration and setting up some variables.
 */
var config = require("../settings.json"),
    args = process.argv.slice(2),

    isWindows = /^win/.test(process.platform);
    _dirname = isWindows ? __dirname.replace(/\\server$/, "") : __dirname.replace(/\/server$/, ""),

    http_cfg  = config.http;
    https_cfg = config.https;