Esempio n. 1
0
  delGuild (guild) {
    this.logger.info(`Guild deleted: ${guild.name} (${guild.id})`)
    this.logger.info(`${chalk.cyan.bold('U:')} ${guild.memberCount} | ${chalk.cyan.bold('S:')} ${guild.shard.id}`)

    this.sendStats()
    this.portal.tunnel(this.logChannel, '', { embed: {
      author: {
        name: guild.name,
        icon_url: guild.iconURL
      },
      title: `Guild Deleted: ${guild.memberCount} members`,
      color: utils.getColour('red'),
      footer: {
        text: `Shard ${guild.shard.id}  |  ${moment().format('ddd Do MMM, YYYY [at] hh:mm:ss a')}`
      }
    }})

    this.db.Guild.fetch(guild.id).then(settings => {
      settings.deleted = true
      return settings.save()
    }).catch(err => {
      this.logger.error(`Could not load settings for ${guild.name} (${guild.id})`)
      this.logger.error(err)
    })
  }
Esempio n. 2
0
  render(error) {
    // Render question
    var message = this.getQuestion();
    var bottomContent = '';

    if (!this.spaceKeyPressed) {
      message +=
        '(Press ' +
        chalk.cyan.bold('<space>') +
        ' to select, ' +
        chalk.cyan.bold('<a>') +
        ' to toggle all, ' +
        chalk.cyan.bold('<i>') +
        ' to invert selection)';
    }

    // Render choices or answer depending on the state
    if (this.status === 'answered') {
      message += chalk.cyan(this.selection.join(', '));
    } else {
      var choicesStr = renderChoices(this.opt.choices, this.pointer);
      var indexPosition = this.opt.choices.indexOf(
        this.opt.choices.getChoice(this.pointer)
      );
      message +=
        '\n' + this.paginator.paginate(choicesStr, indexPosition, this.opt.pageSize);
    }

    if (error) {
      bottomContent = chalk.red('>> ') + error;
    }

    this.screen.render(message, bottomContent);
  }
Esempio n. 3
0
 info: function (normal) {
     logger.trace("#green", "docs:info", "isShot:", normal.isShot, normal.orig);
     if (normal.isShot) {
         logger.txt("\n ", "Shot", "[", chalk.bold(normal.orig), "]", "\n");
         logger.parseMd(path.join(recipeDir, 'shots', normal.name, 'info.md'), path.join(recipeDir, 'shots', normal.name, normal.repoType, 'info.md'));
     } else {
         var strawObj = config.getStraw(normal);
         logger.txt("\n ", chalk.bold(strawObj.name + ":"), "[", normal.repoType + ":" + normal.name, "]", "(", strawObj.description, ")");
         logger.parseMd(path.join(recipeDir, 'straws', normal.name, 'info.md'));
         logger.txt("\n", chalk.bold.green("shots"), "(steps on the workflow)\n");
         var shots = [];
         for (var shot in strawObj.shots) {
             if (strawObj.shots[shot].type === 'straw') {
                 var normalTmp = JSON.parse(JSON.stringify(normal));
                 normalTmp.name = shot;
                 logger.txt("\n", chalk.yellow("## Straw ----"), "\n");
                 logger.txt("", chalk.cyan.bold(shot), "is a straw");
                 this.info(normalTmp);
                 logger.txt("\n", chalk.yellow("## End straw ----"), "\n");
             } else {
                 logger.txt("", chalk.cyan.bold(shot + ":"), "\n");
                 logger.parseMd(path.join(recipeDir, 'shots', shot, 'info.md'), path.join(recipeDir, 'shots', shot, normal.repoType, 'info.md'));
             }
         }
     }
 },
Esempio n. 4
0
sequence('seed', function() {
  console.log(chalk.cyan.bold('Done.'));
  process.chdir(cwd+Seed.paths.separator+Seed.name);
  console.log(chalk.cyan.bold('Copying bowerrc...'));
  run('cp -a '+ Seed.paths.origin + 'seed'+Seed.paths.separator + '.bowerrc '+ cwd+Seed.paths.separator+Seed.name+Seed.paths.separator+'.bowerrc').exec();
  console.log(chalk.cyan.bold('Copying Seed assets...'));
  console.log(chalk.cyan.bold('Running NPM and Bower install...'));
  run('npm install && bower install').exec();
  console.log(chalk.cyan.bold('Done! run gulp serve from your new application!'));
});
Esempio n. 5
0
 async.forEachOfLimit(orderBook, augur.constants.PARALLEL_LIMIT, function (orders, orderType, nextOrderType) {
   var tradeGroupId = augur.trading.generateTradeGroupId();
   if (debugOptions.cannedMarkets) console.log(chalk.cyan.dim("Creating"), chalk.cyan(orderType), chalk.cyan.dim("orders - trade group ID"), chalk.green(tradeGroupId));
   async.forEachOfLimit(orders, augur.constants.PARALLEL_LIMIT, function (outcomeOrders, outcome, nextOutcome) {
     if (debugOptions.cannedMarkets) console.log(chalk.cyan.dim("Creating orders for outcome"), chalk.cyan(outcome));
     async.eachLimit(outcomeOrders, augur.constants.PARALLEL_LIMIT, function (order, nextOrder) {
       createOrder(augur, marketId, parseInt(outcome, 10), numOutcomes, maxPrice, minPrice, numTicks, orderType, order, tradeGroupId, auth, nextOrder);
     }, nextOutcome);
   }, nextOrderType);
 }, callback);
Esempio n. 6
0
                self.spawnCommand('grunt', ['setup']).on('exit', function () {
                    var help = [
                        'I\'m all done. Enter `' + chalk.yellow.bold('grunt serve') + '` to start your application. \nIt will be served on `' + chalk.yellow.bold(self.baboon.app_protocol + '://localhost:' + self.baboon.app_port) + '`.'
                    ];

                    if (self.baboon.app_rights_enabled) {
                        help.push('The administrator account is `' + chalk.cyan.bold('sysadmin') + '` with password `' + chalk.cyan.bold('a') + '`');
                    }

                    self.log(help.join('\n'));
                });
Esempio n. 7
0
 rl.question("Enter Factory name (singular): ", function(method){
     if(method === 'exit' || method.length === 0) {
         saveFile();
         rl.close()
     } else {
         console.log(chalk.cyan.bold('Creating Factory named: %s for url: %s'), method.capitalize(), baseURL + path);
         console.log(chalk.cyan.bold("with methods: \ncreate()\nupdate\nfindAll()\nfindById()\ndelete()\n"));
         factories.push({method: method.capitalize(), url: path});
         nameMethods()
     }
 })
Esempio n. 8
0
WpGruntedThemeGenerator.prototype.askFor = function askFor() {
  var cb = this.async();

  console.log("\n\n"+chalk.cyan.bold("SHALL WE PLAY A GAME?\n\n")+chalk.cyan.bold("Love to.  How about Global Thermonuclear War?\n\n")+chalk.cyan.bold("WOULDN'T YOU PREFER TO INSTALL A WORDPRESS THEME?\n\n")+chalk.cyan.bold("Oh, OK.\n\n\n\n")
  );

  var prompts = [{
    name: 'themeName',
    message: 'Name of the theme you want to create?'
  },{
    name: 'themeNameSpace',
    message: 'Unique name-space for the theme (alphanumeric)?',
    default: function( answers ) {
  		return answers.themeName.replace(/\W/g, '').toLowerCase();
  	}
  },{
    name: 'themeAuthor',
    message: 'Name of the themes author?',
    default: function( answers ) {
  		return 'Substance, Inc.';
  	}
  },{
    name: 'themeAuthorURI',
    message: 'Website of the themes authors?',
    default: function( answers ) {
  		return 'http://www.findsubstance.com';
  	}
  },{
    name: 'themeURI',
    message: 'Website of the themes?',
    default: function( answers ) {
      return 'http://www.'+answers.themeName.replace(/\W/g, '-').toLowerCase()+'.com';
    }
  },{
    name: 'themeDescription',
    message: 'Description of the theme?',
    default: function( answers ) {
  		return 'This is a description for the '+answers.themeName+' theme.';
  	}
  }];

  this.prompt(prompts, function (props) {
    this.themeName = props.themeName;
    this.themeNameSpace = props.themeNameSpace;
    this.themeAuthor = props.themeAuthor;
    this.themeAuthorURI = props.themeAuthorURI;
    this.themeURI = props.themeURI;
    this.themeDescription = props.themeDescription;
    this.jshintTag = '<%= jshint.all %>';

    cb();
  }.bind(this));
};
    .then(function () {
        // If non interactive or user forced, bypass confirmation
        if (!config.interactive || force) {
            return true;
        }

        return Q.nfcall(logger.prompt.bind(logger), {
            type: 'confirm',
            message: 'You are about to remove component "' + chalk.cyan.underline(name) + '" from the bower registry (' + chalk.cyan.underline(config.registry.register) + '). It is generally considered bad behavior to remove versions of a library that others are depending on. Are you really sure?',
            default: false
        });
    })
Esempio n. 10
0
		return this.getAllDeviceAttributes(filter).then(function (devices) {
			if (!devices) {
				return;
			}

			var lines = [];
			for (var i = 0; i < devices.length; i++) {
				var name;
				var device = devices[i];
				var deviceType = '';
				switch (device.product_id) {
					case 0:
						deviceType = ' (Core)';
						break;
					case 6:
						deviceType = ' (Photon)';
						break;
					case 8:
						deviceType = ' (P1)';
						break;
					case 10:
						deviceType = ' (Electron)';
						break;
					case 31:
						deviceType = ' (Raspberry Pi)';
						break;
					default:
						deviceType = ' (Product ' + device.product_id + ')';
				}

				if (!device.name || device.name === 'null') {
					name = '<no name>';
				} else {
					name = device.name;
				}

				if (device.connected) {
					name = chalk.cyan.bold(name);
				} else {
					name = chalk.cyan.dim(name);
				}

				var status = name + ' [' + device.id + ']' + deviceType + ' is ';
				status += (device.connected) ? 'online' : 'offline';
				lines.push(status);

				formatVariables(device.variables, lines);
				formatFunctions(device.functions, lines);
			}

			console.log(lines.join('\n'));
		}).catch(function(err) {
Esempio n. 11
0
 Object.getOwnPropertyNames(strawObj.shots).forEach((shot) => {
   const normalTmp = JSON.parse(JSON.stringify(normal));
   normalTmp.name = shot;
   if (strawObj.shots[shot].type === 'straw') {
     logger.txt('\n', chalk.yellow('## Straw ----'), '\n');
     logger.txt('', chalk.cyan.bold(shot), 'is a straw');
     this.info(normalTmp);
     logger.txt('\n', chalk.yellow('## End straw ----'), '\n');
   } else {
     logger.txt('', chalk.cyan.bold(shot + ':'), '\n');
     this._showShotMd(normalTmp);
   }
 });
Esempio n. 12
0
BespokepluginGenerator.prototype.askFor = function askFor() {
  var cb = this.async();

  // welcome message
  var welcome =
    "\n" +
    chalk.cyan.bold("\noooooooooo.                                          oooo                          o8o          ") +
    chalk.cyan.bold("\n`888'   `Y8b                                         `888                          `\"'          ") +
    chalk.cyan.bold("\n 888     888  .ooooo.   .oooo.o oo.ooooo.   .ooooo.   888  oooo   .ooooo.         oooo  .oooo.o ") +
    chalk.cyan.bold("\n 888oooo888' d88' `88b d88(  \"8  888' `88b d88' `88b  888 .8P'   d88' `88b        `888 d88(  \"8 ") +
    chalk.cyan.bold("\n 888    `88b 888ooo888 `\"Y88b.   888   888 888   888  888888.    888ooo888         888 `\"Y88b.  ") +
    chalk.cyan.bold("\n 888    .88P 888    .o o.  )88b  888   888 888   888  888 `88b.  888    .o .o.     888 o.  )88b ") +
    chalk.cyan.bold("\no888bood8P'  `Y8bod8P' 8\"\"888P'  888bod8P' `Y8bod8P' o888o o888o `Y8bod8P' Y8P     888 8\"\"888P' ") +
    chalk.cyan.bold("\n                                 888                                               888          ") +
    chalk.cyan.bold("\n                                o888o                                          .o. 88P          ") +
    chalk.cyan.bold("\n                                                                               `Y888P           ") +
    "\n" +
    chalk.green.bold("Thanks for writing a Bespoke.js plugin! :)   -@markdalgleish") +
    "\n";

  console.log(welcome);

  var prompts = [
    {
      name: 'githubUser',
      message: 'What is your GitHub username?',
      default: 'someuser'
    },
    {
      name: 'pluginName',
      message: 'What is the name of your plugin?',
      default: 'myplugin'
    },
    {
      name: 'pluginDescription',
      message: 'What is the description of your plugin?',
      default: 'Some feature for Bespoke.js'
    }
  ];

  this.prompt(prompts, function (props) {
    this.githubUser = props.githubUser;
    this.pluginName = this._.slugify(props.pluginName).replace(/^bespoke-/, '').toLowerCase();
    this.pluginNameCamelized = this._.camelize(this.pluginName);
    this.pluginFullName = 'bespoke-' + this.pluginName;
    this.pluginDescription = props.pluginDescription;

    cb();
  }.bind(this));
};
Esempio n. 13
0
function formatTable(modules) {
    var data = [];
    var tableConfig = {
        border: getBorderCharacters("norc"),
        drawHorizontalLine: (index, size) => index <= 1 || index == size
    };
    var stats = {
        moduleCount: modules.length,
        licenseWarning: 0,
        missingLicense: 0,
        missingLicenseFile: 0
    };

    for (let elm in tableConfig.border) {
        tableConfig.border[elm] = chalk.gray.dim(tableConfig.border[elm]);
    }

    data.push([
        chalk.cyan.bold("Module Name"),
        chalk.cyan.bold("Version"),
        chalk.cyan.bold("License"),
        chalk.cyan.bold("License File")
    ]);

    for (let i = 0 ; i < modules.length ; i++) {
        let module = modules[i];
        data.push([
            chalk.bold(module.name),
            module.version,
            module.license ? (module.license.match(/bsd|mit|apache|isc|wtfpl/i)) ? module.license : chalk.yellow(module.license) : chalk.bgRed.white("Unknown"),
            (module.licenseFile ? chalk.green("Yes") : chalk.red("No")) + (module.noticeFile ? " + notice" : "")
        ]);
        if (!module.license) stats.missingLicense += 1;
        if (module.license && !module.license.match(/bsd|mit|apache|isc|wtfpl/i)) stats.licenseWarning += 1;
        if (!module.licenseFile) stats.missingLicenseFile += 1;
    }

    var result = table(data, tableConfig);
    result += `\n${modules.length} modules`;
    if (stats.licenseWarning || stats.missingLicense || stats.missingLicenseFile) {
        var licenseIssues = [];
        if (stats.licenseWarning) licenseIssues.push(chalk.yellow(`${stats.licenseWarning} warning(s)`));
        if (stats.missingLicenseFile) licenseIssues.push(chalk.red(`${stats.missingLicenseFile} missing license file(s)`));
        if (stats.missingLicense) licenseIssues.push(chalk.bgRed.white(`${stats.missingLicense} modules(s) without license`));
        result += "\nLicenses: " + licenseIssues.join(", ");
    }

    return result;
}
Esempio n. 14
0
module.exports = function(context, options, payload) {
  var _uploadSource = function(source) {
    return gcp.storage.buckets.acquire(context.projectId)
    .then(function() {
      return gcp.storage.upload(source.stream, context.projectId);
    });
  };
  if (options.config.get('functions')) {
    utils.logBullet(chalk.cyan.bold('functions:') + ' preparing ' + chalk.bold(options.config.get('functions.source')) + ' directory for uploading...');

    return prepareFunctionsUpload(options).then(function(result) {
      payload.functions = {
        triggers: options.config.get('functions.triggers')
      };

      if (!result) {
        return undefined;
      }
      return _uploadSource(result).then(function() {
        utils.logSuccess(chalk.green.bold('functions:') + ' ' + chalk.bold(options.config.get('functions.source')) + ' folder uploaded successfully');
      }).catch(function(err) {
        utils.logWarning(chalk.yellow('functions:') + ' Upload Error: ' + err.message);
      });
    });
  }

  return RSVP.resolve();
};
	return new Promise((resolve, reject) => {
		console.log(chalk.cyan(`Downloading syntax ${name} ...`));
		console.log(chalk.cyan.dim(`  ${url}`));

		request(url, {}, (err, response, body) => {
			if (err) {
				console.error(chalk.red(`Download failed! ${err.message}`));
				console.error(chalk.red(err.stack));
				return reject(err);
			}
			if (response.statusCode != 200) {
				console.error(chalk.red(`Download failed! because the response code is not 200`));
				console.error(chalk.red(`    actual: ${response.statusCode} ${response.statusMessage}`));
				return reject(new Error(`response code is not 200, but ${response.statusCode}`));
			}

			if (body instanceof Buffer)
				body = body.toString('utf8');
			console.log(chalk.green(`Download success! (length: ${body.length})`));

			writeFile(targetFile, name, body);
			console.log(chalk.green(`Written to "${targetFile}" success!`));

			if (name == defaultSyntax) {
				writeFile(defaultFileName, name, body);
				console.log(chalk.green(`Written to "${defaultFileName}" success!`));
			}
			return resolve(body);
		});
	});
  this.crawler.on('fetchcomplete', function (item) {
    var allowed = true;

    if (this.robots) {
      try {
        allowed = this.robots.isAllowed(item.url, this.crawler.userAgent);
      } catch (e) {
        // silent error
      }
    }

    if (allowed) {
      this.chunk.push({
        loc: item.url,
      });

      if (!this.options.silent) {
        console.log(chalk.cyan.bold('Found:'), chalk.gray(item.url));
      }
    } else {
      if (!this.options.silent) {
        console.log(chalk.bold.magenta('Ignored:'), chalk.gray(item.url));
      }
    }
  }.bind(this));
Esempio n. 17
0
export default suspend(function* (plugin, cb) {
  const dir = path.resolve(__dirname, `../plugins/${plugin}.json`);

  const content = yield fs.readFile(dir, resume());

  const info = JSON.parse(content);
  console.log(chalk.cyan.bold(`Configuring Plugin ${chalk.underline(info.name)}`));

  const config = {};

  askConfig(info, config, suspend(function* askAgain() {
    console.log(chalk.cyan(`[${info.name}] Do you want to add another target?`));
    const answer = yield prompt.get({
      properties: {
        next: {
          type: 'string',
          pattern: /yes|no/,
          default: 'no'
        }
      }
    }, resume());

    if (answer.next === 'yes') {
      askConfig(info, config, suspend(askAgain));
    } else {
      cb(null, {
        [info.name]: config
      });
    }
  }));
});
Esempio n. 18
0
const askConfig = suspend(function* askConfig(info, config, cb) {
  console.log(chalk.cyan.bold(`[${info.name}] Enter target name`));

  const answer = yield prompt.get({
    properties: {
      target: {
        type: 'string',
        default: 'main'
      }
    }
  }, resume());

  const record = config[answer.target] = {};

  if (info.options) {
    const options = yield askOptions(info, resume());

    record.options = options;
  }

  if (info.files) {
    const files = yield askFiles(info, resume());

    record.files = files;
  }

  cb(null, record);
});
Esempio n. 19
0
        .then(() => {
            let installedTarsVersion;

            try {
                installedTarsVersion = require(`${process.cwd()}/tars.json`).version;
                tarsUtils.tarsSay(`TARS version in current project: "${chalk.cyan.bold(installedTarsVersion)}"`, true);
            } catch (error) {
                /* eslint-disable no-undefined */
                installedTarsVersion = undefined;
                /* eslint-enable no-undefined */
            }

            new Download({ extract: true, mode: '755' })
                .get('https://raw.githubusercontent.com/tars/tars/master/package.json')
                .run((error, files) => {
                    if (error || !installedTarsVersion) {
                        return false;
                    }

                    const latestTarsVersion = JSON.parse(files[0].contents.toString()).version;

                    if (installedTarsVersion < latestTarsVersion) {
                        tarsUtils.tarsSay(
                            `Update available for TARS! New version is: "${chalk.cyan.bold(latestTarsVersion)}"`,
                            true
                        );
                        tarsUtils.tarsSay(
                            `Run the command "${chalk.cyan.bold('tars update-project')}" to update TARS in current project. \n`,
                            true
                        );
                    }
                });
        })
 return function (...messages) {
   rawMethod("       " +logLevel+" "+    // indent log messages under jasmine spec headers
     chalk.magenta(logLevelNames[logLevel]) + " " +
     chalk.cyan.underline(("                    "+loggerName).slice(-25)  ) + " " +
     chalk.white(messages.join(" "))
   );
 };
Esempio n. 21
0
function build() {
  console.log(chalk.cyan.bold('Creating optimized production build...'));
  console.log();

  webpack(config, (err, stats) => {
    if (err) {
      console.log(chalk.red.bold('Failed to create a production build!'));
      console.log(chalk.red(err.message || err));
      process.exit(1);
    }

    if (stats.compilation.errors && stats.compilation.errors.length) {
      console.log(chalk.red.bold('Failed to create a production build!'));
      stats.compilation.errors.forEach(err => console.log(chalk.red(err.message || err)));
      process.exit(1);
    }

    const jsonStats = stats.toJson();
    const seconds = jsonStats.time / 1000;
    console.log('Duration: ' + seconds.toFixed(2) + 's');
    console.log();

    console.log(chalk.green.bold('Compiled successfully!'));
  });
}
Esempio n. 22
0
    showCommands: function (title, forceAll) {
        if (title !== null)
            logger.txt("\n", chalk.bold(title), "\n");

        var enriched = docs.enrichCommands(null,true);

        if (config.commands && !forceAll)
            config.commands.forEach((command) => {
                var enrich = enriched.search(command);
                if (enrich)
                    logger.txt("\t", chalk.bold(command), "(", chalk.yellow(enrich.description), ")", enrich.type === 'shot' ? (" - " + chalk.grey("Shot")) : "");
            });
        else
            for (var recipeKey in enriched) {
                var recipe = enriched[recipeKey].___recipe;
                if (recipe) {
                    logger.txt("\n\t", chalk.cyan.bold("from " + recipe.name + " v." + recipe.version), "\n");
                    for (var command in enriched[recipeKey]) {
                        if (command !== '___recipe') {
                            var enrich = enriched[recipeKey][command];
                            logger.txt("\t  ", chalk.bold(command), "(", chalk.yellow(enrich.description), ")", enrich.type === 'shot' ? (" - " + chalk.grey("Shot")) : "");
                        }
                    }
                }
            }
    },
Esempio n. 23
0
 child.once('message', function(msg) {
   process.emit('interactor:daemon:ready');
   console.log(msg);
   console.log(chalk.cyan.bold('[Keymetrics.io]') + ' Log: %s | Conf: %s | PID: %s', cst.INTERACTOR_LOG_FILE_PATH,
              cst.INTERACTION_CONF,
              cst.INTERACTOR_PID_PATH);
   return setTimeout(function() {cb(null, child)}, 100);
 });
  this.crawler.on('fetchcomplete', function (item) {
    this.chunk.push({
      loc: item.url,
    });

    if (!this.options.silent) {
      console.log(chalk.cyan.bold('Found:'), chalk.gray(item.url));
    }
  }.bind(this));
Esempio n. 25
0
                .run((error, files) => {
                    if (error || !installedTarsVersion) {
                        return false;
                    }

                    const latestTarsVersion = JSON.parse(files[0].contents.toString()).version;

                    if (installedTarsVersion < latestTarsVersion) {
                        tarsUtils.tarsSay(
                            `Update available for TARS! New version is: "${chalk.cyan.bold(latestTarsVersion)}"`,
                            true
                        );
                        tarsUtils.tarsSay(
                            `Run the command "${chalk.cyan.bold('tars update-project')}" to update TARS in current project. \n`,
                            true
                        );
                    }
                });
Esempio n. 26
0
export default suspend(function* (info, cb) {
  prompt.start();

  console.log(chalk.cyan.bold(`\n[${info.name}] Options`));

  const options = yield prompt.get(info.options, resume());
  normalize(options);

  cb(null, options);
});
Esempio n. 27
0
        .run((error, files) => {

            if (error) {
                tarsUtils.tarsSay('Something is gone wrong! Please, try again later.', true);

                throw new Error(error);
            }

            const latestTarsCliVersion = JSON.parse(files[0].contents.toString()).version;

            if (installedTarsCliVersion < latestTarsCliVersion) {
                tarsUtils.tarsSay('Version of installed TARS-CLI is not the latest!');
                tarsUtils.tarsSay(`Please, update TARS-CLI via ${chalk.cyan.bold('tars update')} at first!`);
                tarsUtils.tarsSay(`The latest version is: ${chalk.cyan.bold(latestTarsCliVersion)}`);
                tarsUtils.tarsSay(`Installed version is: ${chalk.cyan.bold(installedTarsCliVersion)}`, true);
                return false;
            }

            downloadNewVersion()
                .then(() => {
                    downloadedVersion = require(`${dest.tars.fullPath}/tars.json`).version;

                    if (currentTarsVersion === downloadedVersion && !commandOptions.force) {
                        tarsUtils.tarsSay('You have the latest version of TARS already!', true);
                        removeUselessFiles(true);
                        return;
                    }

                    if (commandOptions.force) {
                        tarsUtils.tarsSay('Force update!');
                    } else {
                        tarsUtils.tarsSay(`Ok, new version ${chalk.cyan.bold(downloadedVersion)} is available. Let's do it!`);
                    }

                    startUpdateProcess();
                })
                .catch(downloadError => {
                    tarsUtils.tarsSay(chalk.red('Something is gone wrong...'));
                    tarsUtils.tarsSay('Files in your project have not been changed');
                    tarsUtils.tarsSay('Please, repost the message and the stack trace of Error to developer tars.builder@gmail.com', true);
                    console.error(downloadError.stack);
                });
        });
Esempio n. 28
0
                .run((error, files) => {
                    if (error) {
                        return resolve();
                    }

                    const latestTarsCliVersion = JSON.parse(files[0].contents.toString()).version;

                    if (installedTarsCliVersion < latestTarsCliVersion) {
                        tarsUtils.tarsSay(
                            `Update available for TARS-CLI! New version is: "${chalk.cyan.bold(latestTarsCliVersion)}"`,
                            true
                        );
                        tarsUtils.tarsSay(
                            `Run the command "${chalk.cyan.bold('tars update')}" to update TARS-CLI. \n`,
                            true
                        );
                    }
                    return resolve();
                });
Esempio n. 29
0
  /**
  Analyze a single resume.
  */
  function _analyze( resumeObject, nlzrs, opts, log ) {
    var rez = resumeObject.rez;
    var safeFormat =
      (rez.meta && rez.meta.format && rez.meta.format.startsWith('FRESH')) ?
      'FRESH' : 'JRS';

    var padding = 20;
    log(chalk.cyan('Analyzing ') + chalk.cyan.bold(safeFormat) +
      chalk.cyan(' resume: ') + chalk.cyan.bold(resumeObject.file));
    var info = _.mapObject( nlzrs, function(val, key) {
      return val.run( resumeObject.rez );
    });

    log(chalk.cyan.bold('\nSECTIONS') + chalk.cyan(' (') + chalk.white.bold(_.keys(info.totals).length) + chalk.cyan('):\n'));
    var pad = require('string-padding');
    _.each( info.totals, function(tot, key) {
      log(chalk.cyan(pad(key + ': ',20)) + chalk.cyan.bold(pad(tot.toString(),5)));
    });

    log();
    log(chalk.cyan.bold('COVERAGE') + chalk.cyan(' (') + chalk.white.bold( info.coverage.pct ) + chalk.cyan('):\n'));
    log(chalk.cyan(pad('Total Days: ', padding)) + chalk.cyan.bold( pad(info.coverage.duration.total.toString(),5) ));
    log(chalk.cyan(pad('Employed: ', padding)) + chalk.cyan.bold( pad((info.coverage.duration.total - info.coverage.duration.gaps).toString(),5) ));
    log(chalk.cyan(pad('Gaps:     ', padding + 4)) + chalk.cyan.bold(info.coverage.gaps.length) + chalk.cyan('  [') + info.coverage.gaps.map(function(g) {
        var clr = 'green';
        if( g.duration > 35 ) clr = 'yellow';
        if( g.duration > 90 ) clr = 'red';
        return chalk[clr].bold( g.duration) ;
      }).join(', ') + chalk.cyan(']') );
      log(chalk.cyan(pad('Overlaps:     ', padding + 4)) + chalk.cyan.bold(info.coverage.overlaps.length) + chalk.cyan('  [') + info.coverage.overlaps.map(function(ol) {
          var clr = 'green';
          if( ol.duration > 35 ) clr = 'yellow';
          if( ol.duration > 90 ) clr = 'red';
          return chalk[clr].bold( ol.duration) ;
        }).join(', ') + chalk.cyan(']') );

    var tot = 0;
    log();
    log( chalk.cyan.bold('KEYWORDS') + chalk.cyan(' (') + chalk.white.bold( info.keywords.length ) +
      chalk.cyan('):\n\n') +
      info.keywords.map(function(g) {
        tot += g.count;
        return chalk.cyan( pad(g.name + ': ', padding) ) + chalk.cyan.bold( pad( g.count.toString(), 5 )) + chalk.cyan(' mentions');
      }).join('\n'));

    log(chalk.cyan( pad('TOTAL: ', padding) ) + chalk.white.bold( pad( tot.toString(), 5 )) + chalk.cyan(' mentions'));
  }
Esempio n. 30
0
                client.repositories( function(err, data) {

                    if ( err ) {
                        console.log(chalk.red.bold('An error occurred: ' + err));
                    } else {
                        console.log(chalk.cyan.bold('Total Repositories: ' + data.length));
                    }

                    // Line break at the bottom
                    console.log();
                });