this.on('end', function () { this.log( '\nPlease run ' + chalk.yellow.bold('npm install & bower install ') + 'to install all the dependencies' + '\n' ); });
/** @type {{id: number, task: string}} taskDetails */ (taskDetails) => { timers[taskDetails.id] = process.hrtime(); const taskName = (taskDetails.task === this.DEFAULT_TASK_NAME) ? chalk.yellow.bold("Default task") : `Task ${chalk.yellow(taskDetails.task)}`; console.log(`${chalk.bgYellow.black(" kaba ")} ${taskName} started`); }
end() { if (this.warning) { this.log(`\n${chalk.yellow.bold('WARNING!')} Kubernetes configuration generated, but no Jib cache found`); this.log('If you forgot to generate the Docker image for this application, please run:'); this.log(this.warningMessage); } else { this.log(`\n${chalk.bold.green('Kubernetes configuration successfully generated!')}`); } this.log( `${chalk.yellow.bold( 'WARNING!' )} You will need to push your image to a registry. If you have not done so, use the following commands to tag and push the images:` ); for (let i = 0; i < this.appsFolders.length; i++) { const originalImageName = this.appConfigs[i].baseName.toLowerCase(); const targetImageName = this.appConfigs[i].targetImageName; if (originalImageName !== targetImageName) { this.log(` ${chalk.cyan(`docker image tag ${originalImageName} ${targetImageName}`)}`); } this.log(` ${chalk.cyan(`${this.dockerPushCommand} ${targetImageName}`)}`); } this.log('\nYou can deploy all your apps by running the following script:'); this.log(` ${chalk.cyan('./kubectl-apply.sh')}`); if (this.gatewayNb + this.monolithicNb >= 1) { const namespaceSuffix = this.kubernetesNamespace === 'default' ? '' : ` -n ${this.kubernetesNamespace}`; this.log("\nUse these commands to find your application's IP addresses:"); for (let i = 0; i < this.appsFolders.length; i++) { if (this.appConfigs[i].applicationType === 'gateway' || this.appConfigs[i].applicationType === 'monolith') { this.log(` ${chalk.cyan(`kubectl get svc ${this.appConfigs[i].baseName.toLowerCase()}${namespaceSuffix}`)}`); } } this.log(); } // Make the apply script executable try { fs.chmodSync('kubectl-apply.sh', '755'); } catch (err) { this.log( `${chalk.yellow.bold( 'WARNING!' )}Failed to make 'kubectl-apply.sh' executable, you may need to run 'chmod +x kubectl-apply.sh'` ); } }
shelljs.exec('oc version', { silent: true }, (code, stdout, stderr) => { if (stderr) { this.log(`${chalk.yellow.bold('WARNING!')} oc 1.3 or later is not installed on your computer.\n` + 'Make sure you have OpenShift Origin / OpenShift Container Platform and CLI installed. Read' + ' https://github.com/openshift/origin/\n'); } done(); });
yoyo.prototype._exit = function _exit() { this.insight.track('yoyo', 'exit'); console.log( '\nBye from us! Chat soon.' + '\n' + '\n Add' + chalk.red.bold('y') + ' Osmani' + '\n Sindr' + chalk.red.bold('e') + ' Sorhus' + '\n Brian F' + chalk.red.bold('o') + 'rd' + '\n Eric Bidel' + chalk.red.bold('m') + 'an' + '\n P' + chalk.red.bold('a') + 'ul Irish' + '\n Mickael Da' + chalk.red.bold('n') + 'iel' + '\n Pasca' + chalk.yellow.bold('1') + ' Hartig' + '\n Stephen S' + chalk.cyan.bold('.') + 'wchuk' + '\n Frederick R' + chalk.yellow.bold('0') + 's' + '\n'); };
}, function(err, result) { if (err) console.warn(err); console.log(chalk.yellow.bold('Result:')) console.log(result.length + ' data'); res.json({ data: result }); });
exec('gulp --version', function (err) { if (err) { this.log(chalk.yellow.bold('WARNING!') + ' gulp is not found on your computer.\n', ' Install gulp using npm command: ' + chalk.yellow('npm install -g gulp-cli') ); } done(); }.bind(this));
exec('bower --version', function (err) { if (err) { this.log(chalk.yellow.bold('WARNING!') + ' bower is not found on your computer.\n', ' Install bower using npm command: ' + chalk.yellow('npm install -g bower') ); } done(); }.bind(this));
AppGenerator.prototype.someQuestions = function someQuestions() { var welcome = chalk.yellow(separator) + chalk.red('\n _') + chalk.yellow('\n /\\ ') + chalk.red.bold('(_)') + chalk.yellow.bold('\n / \\ _ _ _ __ __ _ ') + chalk.red.bold('_ ___ ') + chalk.yellow.bold('\n / /\\ \\| | | | \'__/ _` |') + chalk.red.bold(' | / __|') + chalk.yellow.bold('\n / ____ \\ |_| | | | (_| |_') + chalk.red.bold('| \\__ \\') + chalk.yellow.bold('\n /_/ \\_\\__,_|_| \\__,_(_)') + chalk.red.bold(' |___/') + chalk.red.bold('\n _/ |') + chalk.red.bold('\n ' + '|__/') + chalk.yellow(separator) + chalk.yellow('\n'); console.log(welcome); console.info('Generating your awesome app. Stay tuned ;)'); console.info(chalk.yellow(separator)); };
function showBalances(augur, address, label, callback) { console.log(chalk.yellow.dim(label), chalk.yellow(address)); showCashBalance(augur, address, label, function (err) { if (err) { console.log(chalk.red(err)); } showEthBalance(augur, address, label, callback); }); }
shelljs.exec('kubectl version', { silent: true }, (code, stdout, stderr) => { if (stderr) { this.log( `${chalk.yellow.bold('WARNING!')} kubectl 1.2 or later is not installed on your computer.\n` + 'Make sure you have Kubernetes installed. Read http://kubernetes.io/docs/getting-started-guides/binary_release/\n' ); } done(); });
exec('git ls-remote git://github.com/jhipster/generator-jhipster.git HEAD', {timeout: 15000}, function (error) { if (error) { this.log(chalk.yellow.bold('WARNING!') + ' Failed to connect to "git://github.com"\n', ' 1. Check your Internet connection.\n', ' 2. If you are using an HTTP proxy, try this command: ' + chalk.yellow('git config --global url."https://".insteadOf git://') ); } done(); }.bind(this));
install: function() { console.log(chalk.yellow.bold('[ Install ]')); /* -- Set permissions on the entire Craft install tree */ console.log(chalk.green('> Setting global permissions to 755 / 644')); child_process.execSync('chmod -R 755 *'); child_process.execSync('find . -type f -exec chmod 644 {} \\;'); console.log(chalk.green('> Setting permissions on craft/app to 775 / 644')); child_process.execSync('chmod -R 775 craft/app'); child_process.execSync('find craft/app/ -type f -exec chmod 664 {} \\;'); console.log(chalk.green('> Setting permissions on craft/config to 775 / 644')); child_process.execSync('chmod -R 775 craft/config'); child_process.execSync('find craft/config/ -type f -exec chmod 664 {} \\;'); console.log(chalk.green('> Setting permissions on craft/storage to 775 / 644')); child_process.execSync('chmod -R 775 craft/storage'); child_process.execSync('find craft/storage/ -type f -exec chmod 664 {} \\;'); /* -- Create a bare remote git repository */ if (this.install.REMOTE_GIT_ORIGIN) { console.log(chalk.green('> Creating bare remote git repository')); child_process.execSync("ssh " + this.install.REMOTE_GIT_ORIGIN + " 'git init --bare " + this.answers['appName'] + ".git'"); /* -- Initialize the local git directory, add all of the files, commit them, and push them to origin master */ console.log(chalk.green('> Initializing local git repository')); child_process.execSync('git init'); child_process.execSync('git remote add origin ' + this.install.REMOTE_GIT_ORIGIN + ':' + this.answers['appName'] + '.git'); for (var i = 0; i < this.install.CRAFT_PLUGINS.length; i++) { var plugin = this.install.CRAFT_PLUGINS[i]; console.log('+ ' + chalk.green(plugin.name) + ' added as submodule'); child_process.execSync('git submodule add -f ' + plugin.url + ' ' + plugin.path); } console.log(chalk.green('> Adding project files to git repository')); child_process.execSync('git add -A'); child_process.execSync('git add -f craft/storage/.gitignore'); console.log(chalk.green('> Doing initial commit to git repository')); child_process.execSync('git commit -m "initial commit"'); console.log(chalk.green('> Pushing git repository to origin master')); child_process.execSync('git push origin master'); } /* -- Install Bower modules */ if (fs.existsSync('bower.json')) { console.log(chalk.green('> Bower Install')); this.bowerInstall(this.install.BOWER_OPTIONS); } /* -- Install NPM modules */ if (fs.existsSync('package.json')) { console.log(chalk.green('> NPM Install')); this.npmInstall(this.install.NPM_OPTIONS); } },
static validate(camelCaseProperty, prop, value, selectors = '', position = {}) { if (allStylePropTypes[camelCaseProperty]) { let error = allStylePropTypes[camelCaseProperty](value, prop, selectors); if (error) { const message = `line: ${position.start.line}, column: ${position.start.column} - ${error.message}`; console.warn(chalk.yellow.bold(message)); pushWarnMessage(message); } return error; } else { if (!particular[camelCaseProperty]) { const message = `line: ${position.start.line}, column: ${position.start.column} - "${prop}: ${value}" is not valid in "${selectors}" selector`; console.warn(chalk.yellow.bold(message)); pushWarnMessage(message); } } }
Login.run = function(ionic, callback) { var self = this; if (!this.email && !this.password) { var schema = [{ name: 'email', pattern: /^[A-z0-9!#$%&'*+\/=?\^_{|}~\-]+(?:\.[A-z0-9!#$%&'*+\/=?\^_{|}~\-]+)*@(?:[A-z0-9](?:[A-z0-9\-]*[A-z0-9])?\.)+[A-z0-9](?:[A-z0-9\-]*[A-z0-9])?$/, // eslint-disable-line max-len description: chalk.yellow.bold('Email:'), required: true }, { name: 'password', description: chalk.yellow.bold('Password:'******'\nTo continue, please login to your Ionic account.'); log.info(chalk.bold('Don\'t have one? Create a one at: ') + chalk.bold(settings.IONIC_DASH + '/signup') + '\n'); prompt.override = argv; prompt.message = ''; prompt.delimiter = ''; prompt.start(); prompt.get(schema, function(err, result) { if (err) { return Utils.fail('Error logging in: ' + err); } self.email = result.email; self.password = result.password; self.requestLogIn(ionic, callback, true); }); } else { // cmd line flag were added, use those instead of a prompt self.requestLogIn(ionic, callback, false); } };
grunt.registerMultiTask("bower-install-simple", "Install Bower Dependencies", function () { /* prepare options */ var options = this.options({ /* bower configuration options (renderer specific) */ color: true, /* bower --config.color=true */ cwd: process.cwd(), /* bower --config.cwd=`pwd` */ /* bower install command options */ forceLatest: false, /* bower install --force-latest */ production: false, /* bower install --production */ /* bower configuration options (general) */ interactive: true, /* bower --config.interactive=true */ directory: "bower_components" /* bower --config.directory=<dir> */ }); grunt.verbose.writeflags(options, "Options"); /* display header to explicitly inform user about our operation */ if (options.color) grunt.log.writeln(chalk.blue("Install Bower Dependencies") + " [" + chalk.yellow.bold(this.target) + "]"); else grunt.log.writeln("Install Bower Dependencies [" + this.target + "]"); /* run programatically the functionality behind the official "bower install" command */ var done = this.async(); var renderer = new bowerRenderer("install", { color: options.color, cwd: options.cwd }); bower.commands.install([], { "force-latest": options.forceLatest, production: options.production }, { interactive: options.interactive, directory: options.directory, cwd: options.cwd }) .on("log", function (log) { renderer.log(log); }) .on("prompt", function (prompt, callback) { renderer.prompt(prompt).then(function(answer) { callback(answer); }); }) .on("error", function (err) { renderer.error(err); done(false); }) .on("end", function (data) { renderer.end(data); done(); }); });
/** * [Provides instructions to user after creating a new project.] */ function intro() { console.log(` Project created! \`cd ${chalk.bold.red(name)}/\` to enter folder. Write ES2015 code in \`src/\` folder. Run \`${chalk.yellow.bold('daruma')} build\` in root of project directory. Your compiled code will be in the \`dist/\` folder. Enjoy ${chalk.bold.yellow('freedom')}! `); }
exec('git --version', function (err) { if (err) { this.log(chalk.yellow.bold('WARNING!') + ' git is not found on your computer.\n', ' Install git: ' + chalk.yellow('http://git-scm.com/') ); } else { this.gitInstalled = true; } done(); }.bind(this));
}], function (answers) { this.options.file = answers.file; var generatedSlug = slug(answers.name, {lower: true}); this.log('Generated slug is: ' + chalk.yellow.bold(generatedSlug)); this.options.speaker = { id: generatedSlug, name: answers.name }; done(); }.bind(this));
return richPRs.filter((pr) => { if (!pr.merged_at) { this.log( `${chalk.yellow.bold('WARNING')} ${pr.html_url} was not merged,` + ` should have the milestone unset.` ); return false; } return true; }).map((pr) => {
augur.api.ShareToken.balanceOf(shareTokenPayload, function (err, balance) { if (err) { console.log(chalk.red(err)); return callback(err); } var adjusted = new BigNumber(speedomatic.unfix(balance, "string")).times(new BigNumber(numTicks)); console.log(chalk.yellow.dim("Market Outcome: "), chalk.yellow(outcomeId)); console.log("attoShare: " + chalk.green(balance), "Shares: " + chalk.green(speedomatic.unfix(balance, "string")), "Adjusted Shares: " + chalk.green(adjusted)); nextOutcome(null); });
AppGenerator.prototype.askFor = function askFor() { var cb = this.async(); // welcome message var welcome = '\n _-----_' + '\n | |' + '\n |' + chalk.red('--(o)--') + '| .--------------------------.' + '\n `---------´ | ' + chalk.yellow.bold('Welcome to Yeoman') + ', |' + '\n ' + chalk.yellow('(') + ' _' + chalk.yellow('´U`') + '_ ' + chalk.yellow(')') + ' | ' + chalk.yellow.bold('ladies and gentlemen!') + ' |' + '\n /___A___\\ \'__________________________\'' + '\n ' + chalk.yellow('| ~ |') + '\n __' + chalk.yellow('\'.___.\'') + '__' + '\n ´ ' + chalk.red('` |') + '° ' + chalk.red('´ Y') + ' `\n'; console.log(welcome); console.log('This comes with requirejs, lodash, and grunt all ready to go'); if (this.options.promptDefaults) { this.appname = this.options.promptDefaults.appname; this.appdescription = this.options.promptDefaults.appdescription; cb(); return; } var prompts = [{ name: 'appname', message: 'What is the name of your app?', default: this.appname }, { name: 'appdescription', message: 'Description:', default: 'An awesome requirejs app' }]; this.prompt(prompts, function (props) { this.appname = props.appname; this.appdescription = props.appdescription; cb(); }.bind(this)); };
], function (err) { if (err === 127) { this.log('Could not find the ' + chalk.yellow.bold('git') + ' command. Make sure Git is installed on this machine'); return; } this.log(chalk.green('complete') + ' Git repository has been setup'); done(); }.bind(this));
return function () { if (!this.options['skip-install']) { this.installDependencies(); if (this.appScript === 'ts') { this.log(`Running ${chalk.yellow.bold('tsd reinstall --save')}. If this fails run the commands ` + 'yourself. TSD must be installed via `npm install -g tsd`.'); this.spawnCommand('tsd', ['reinstall', '--save']); } } };
pagespeed(url, strategy, locale, filterThirdParty).then(response => { if (response.error && response.error.code === 400) { spinner.stop(); logUpdate( chalk.red.bold(`Could not resolve the URL: ${chalk.blue.bold(url)} Please, check the spelling or make sure is accessible.'`) ); } let isToShowUsabilityScore = (strategy === 'mobile'); let speedScore = response.ruleGroups.SPEED.score; let message; if (speedScore < 21) { message = chalk.red.bold(`${logSymbols.error} Score: ${speedScore}`); } else if (speedScore < 80) { message = chalk.yellow.bold(`${logSymbols.warning} Score: ${speedScore}`); } else { message = chalk.green.bold(`${logSymbols.success} Score: ${speedScore}`); } if (isToShowUsabilityScore) { let usabilityScore = response.ruleGroups.USABILITY.score; if (usabilityScore < 21) { message += chalk.red.bold(` ${logSymbols.success} Usability: ${usabilityScore}` ); } else if (usabilityScore < 80) { message += chalk.yellow.bold(` ${logSymbols.success} Usability: ${usabilityScore}`); } else { message += chalk.green.bold(` ${logSymbols.success} Usability: ${usabilityScore}`); } } spinner.stop(); logUpdate(message); });
end() { if (this.warning) { this.log(`\n${chalk.yellow.bold('WARNING!')} OpenShift configuration generated with missing images!`); this.log(this.warningMessage); } else { this.log(`\n${chalk.bold.green('OpenShift configuration successfully generated!')}`); } this.log(`${chalk.yellow.bold('WARNING!')} You will need to push your image to a registry. If you have not done so, use the following commands to tag and push the images:`); for (let i = 0; i < this.appsFolders.length; i++) { const originalImageName = this.appConfigs[i].baseName.toLowerCase(); const targetImageName = this.appConfigs[i].targetImageName; if (originalImageName !== targetImageName) { this.log(` ${chalk.cyan(`docker image tag ${originalImageName} ${targetImageName}`)}`); } this.log(` ${chalk.cyan(`${this.dockerPushCommand} ${targetImageName}`)}`); } this.log('\nYou can deploy all your apps by running: '); this.log(` ${chalk.cyan(`${this.directoryPath}/ocp/ocp-apply.sh`)}`); if (this.gatewayNb >= 1 || this.microserviceNb >= 1) { this.log('OR'); this.log(` ${chalk.cyan(`oc apply -f ${this.directoryPath}/ocp/registry`)}`); if (this.monitoring === 'elk' || this.monitoring === 'prometheus') { this.log(` ${chalk.cyan(`oc apply -f ${this.directoryPath}/ocp/monitoring`)}`); } for (let i = 0; i < this.appsFolders.length; i++) { this.log(` ${chalk.cyan(`oc apply -f ${this.directoryPath}/ocp/${this.appConfigs[i].baseName}`)}`); } this.log('and then install the apps from OpenShift console by choosing the template created in the namespace. '); } if (this.gatewayNb + this.monolithicNb >= 1) { this.log('\nUse these commands to find your application\'s IP addresses:'); for (let i = 0; i < this.appsFolders.length; i++) { if (this.appConfigs[i].applicationType === 'gateway' || this.appConfigs[i].applicationType === 'monolith') { this.log(` ${chalk.cyan(`oc get svc ${this.appConfigs[i].baseName}`)}`); } } this.log(); } }
initializing: function () { this.pkg = require('../package.json'); this.argument('name', { type: String, required: false }); this.appname = this.name ||this.appname; this.appname = this._.camelize(this._.slugify(this._.humanize(this.appname))); this.filters = {}; this.log(chalk.yellow.bold('\nWelcome to Mean-Stack generator !\nLet me ask you some questions...\n')); },
Setup.promptForFacebookInfo = function promptForFacebookInfo() { var schema = [{ name: 'app_id', description: chalk.yellow.bold('Facebook App ID:'), required: true }, { name: 'app_name', description: chalk.yellow.bold('App Name:'), required: true }]; return Setup.promptUserPromise(schema) .then(function(result) { var fbInfo = { app_id: result.app_id, app_name: result.app_name } return fbInfo; }); };
chunk.forEach(line => { if (line.includes(localKey)) { const [, , version] = /"@lk\/([\w-]+)": "(\^?[\d.]+)"/.exec(line) || []; logger.log( `${chalk.white.bold( `You had a local change of` )} ${chalk.yellow.bold( `${localChanges[localKey]}` )} ${chalk.white.bold( `for` )} ${chalk.yellow.bold( `${localKey}` )}${chalk.white.bold( `, but we used HEAD's version of` )} ${chalk.yellow.bold(`${version}`)}` ); } });
this.on('end', function () { // Clean up temp files spawn('rm', ['-r', '.jekyll'], { stdio: 'inherit' }); // Install Grunt and Bower dependencies this.installDependencies({ skipInstall: options['skip-install'] }); if (bundle === false) { console.log(chalk.yellow.bold('Bundle install failed. Try running the command yourself.')); } });