Esempio n. 1
0
let done = () => {
    let hr = chalk.green.bold(String.fromCharCode(8212).repeat(process.stdout.columns * 0.125));
    let duration = Date.now() - start;

    // building done
    console.log(`\n${hr}\nFinished building. ${chalk.blue.bold('(')}${duration}ms${chalk.blue.bold(')')}`);
};
Esempio n. 2
0
 .then((result) => {
     if (newlevel) {
         cmdUtil.log(chalk.blue.bold('The logging level was successfully changed for: ')+businessNetworkName);
     } else {
         cmdUtil.log(chalk.blue.bold('The current logging level is: ')+result);
     }
 });
Esempio n. 3
0
		).then( function(){
			this.log(
				chalk.green.bold( 'Success: ' ) +
				chalk.blue.bold( this._camelCasify( this.configKey ) ) +
				' has been set to ' +
				chalk.blue.bold( this.configVal )
			);
			done();
		}.bind( this ) );
  displayedResults.forEach(result => {
    const { title, score, view_count, creation_date, last_edit_date, link } = result;
    const asked = moment.unix(creation_date).fromNow();
    const active = last_edit_date === undefined ?
      'not defined' :
      moment.unix(last_edit_date).fromNow();

    console.log(white.bold(`  ${underline(`Question: ${title}`)}\n`));
    console.log(white(`    Score: ${green.bold(score)}\n`));
    console.log(white(`    Asked: ${blue.bold(asked)}`));
    console.log(white(`    Viewed: ${magenta.bold(`${view_count} times`)}`));
    console.log(white(`    Active: ${blue.bold(active)}\n`));
    console.log(white(`    URL: ${yellow(link)}\n`));
  });
Esempio n. 5
0
 (result) => {
   //write the buffer to a file
     fs.writeFileSync(argv.archiveFile,result);
     cmdUtil.log(chalk.blue.bold('\nWritten Business Network Definition Archive file to '));
     cmdUtil.log(chalk.blue('\tOutput file: ')+argv.archiveFile);
     return;
 }
Esempio n. 6
0
	function fixBugsInRepo (repoObject) {

		console.log(chalk.blue.underline(repoObject.full_name))
		console.log(chalk.gray(`(${repoObject.html_url})`))

		process.stdout.write('- Clone')

		return Clone
			.clone(
				repoObject.html_url,
				path.join(reposPath, repoObject.full_name)
			)
			.then(gitRepo => {
				console.log(chalk.green(' ✔'))
				if (gitRepo.isEmpty()) {
					throw new Error('Repo is empty')
				}
				hoistedGitRepo = gitRepo

				process.stdout.write('- Get head commit')
				return gitRepo.getHeadCommit()
			})
			.then(commit => commit.getTree())
			.then(fileTree => {
				console.log(chalk.green(' ✔'))

				function toPromiseChain (promiseChain, fixingModule) {
					return promiseChain
						.then(previousFilesChanged =>
							fixingModule({
								repo: hoistedGitRepo,
								fileTree,
								authorSignature: Signature.now(
									author.name,
									author.email,
								),
								committerSignature: Signature.now(
									committer.name,
									committer.email,
								),
							})
							.then(currentFilesChanged =>
								previousFilesChanged || currentFilesChanged
							)
						)
				}

				// Call all fixing modules
				return modules.reduce(
					toPromiseChain,
					Promise.resolve(false)
				)
			})
			.then(filesHaveChanged => {
				if (!filesHaveChanged) {
					throw new Error('unfixable')
				}
				return repoObject
			})
	}
Esempio n. 7
0
function gitWrapper(repo, args, cwd, callback) {
  var git = spawn('git', args, {
    cwd: cwd,
    stdout: 'ignore'
  });
  var operation = args[0];
  // print a nice status message "=== pull foo ==="
  if (!options.quiet) {
    var sides = chalk.blue('===');
    console.log(sides, chalk.blue.bold(operation), chalk.bold(path.basename(repo.to, '.git')), sides);
  }
  var errData = [];
  git.stderr.on('data', function(data) {
    errData.push(String(data));
  });
  git.on('close', function(code) {
    if (code !== 0) {
      failed.push({
        operation: operation,
        reason: errData.join(EOL),
        repo: repo
      });
    }
    callback();
  });
}
 _endMessage: function () {
   console.log(''); //empty line
   console.log("run " + chalk.blue.bold("'grunt serve'") + " to serve development version with live-reload");
   console.log("run " + chalk.blue("'grunt serve:dist'") + " to serve production version (uglified -- no live-reload)");
   console.log("run " + chalk.blue("'grunt'") + " to build the app");
   console.log("run " + chalk.blue("'grunt test'") + " to test the app");
 },
Esempio n. 9
0
  archive.open(function (err) {
    if (err) return onerror(err)
    if (argv.resume && !archive.owner) return onerror('You cannot resume this link')

    logger.status('', 0) // reserve line for file progress
    logger.status('', 1) // reserve total progress and size
    logger.status('Creating Link...', 2) // reserve for dat link

    if ((archive.live || archive.owner) && archive.key) {
      logger.status(chalk.bold('[Sharing] ') + chalk.blue.underline(archive.key.toString('hex')), 2)
      var swarm = createSwarm(archive, argv)
      swarmLogger(swarm, logger)
    }

    logger.status(chalk.bold('[Status]'), 3)
    logger.status(chalk.blue('  Reading Files...'), 4)

    archive.on('upload', function (data) {
      stats.bytesTransferred += data.length
      stats.transferRate(data.length)
      logger.status(chalk.blue('  Uploading ' + prettyBytes(stats.transferRate()) + '/s'), 5)
      if (noDataTimeout) clearInterval(noDataTimeout)
      noDataTimeout = setInterval(function () {
        logger.status(chalk.blue('  Uploading ' + prettyBytes(stats.transferRate()) + '/s'), 5)
      }, 100)
    })

    each(walker(dir), appendEntry, done)
  })
Esempio n. 10
0
    archive.finalize(function (err) {
      if (err) return onerror(err)

      if (!archive.live) {
        logger.status(chalk.bold('[Sharing] ') + chalk.blue.underline(archive.key.toString('hex')), 2)
        logger.status(chalk.blue('  Static Dat Finalized'), 4)
        logger.status(chalk.blue('  Waiting for connections...'), -1)
        var swarm = createSwarm(archive, argv)
        swarmLogger(swarm, logger)
        return
      }

      var dirName = dir === '.' ? process.cwd() : dir

      logger.status(chalk.blue('  Watching ' + chalk.bold(dirName) + '...'), 4)
      logger.status(chalk.blue('  Waiting for connections...'), -1)

      yoloWatch(dir, function (name, st) {
        logger.status('         ' + name, 0)
        archive.append({type: st.isDirectory() ? 'directory' : 'file', name: name}, function () {
          logger.message(chalk.green.dim('  [Done] ') + chalk.dim(name))
          logger.status('', 0)
          printTotalStats()
        })
      })
    })
Esempio n. 11
0
        datjson.write(datInfo, function (err) {
          if (err) return exitErr(err)
          // TODO: write published url to dat.json (need spec)
          var msg = output(`

            We ${body.updated === 1 ? 'updated' : 'published'} your dat!
            ${chalk.blue.underline(`${opts.server}/${whoami.username}/${datInfo.name}`)}
          `)// TODO: get url back? it'd be better to confirm link than guess username/datname structure

          console.log(msg)
          if (body.updated === 1) {
            console.log(output(`

              ${chalk.dim.green('Cool fact #21')}
              ${opts.server} will live update when you are sharing your dat!
              You only need to publish again if your dat link changes.
            `))
          } else {
            console.log(output(`

              Remember to use ${chalk.green('dat share')} before sharing.
              This will make sure your dat is available.
            `))
          }
          process.exit(0)
        })
Esempio n. 12
0
export default function init(l3e, options) {
  const [ templateName, projectName ] = options
  const dest = resolve(projectName)
  const getResource = (templateName) => {
    return new Promise((resolve) => {
      if (! exists(templateName)) {
        const tmp = `/tmp/l3e-template-${uid()}`
        download(templateName, tmp, (err) => {
          if (err) l3e.Logger.fatal(err)
          resolve(tmp)
        })
      } else {
        resolve()
      }
    })
  }

  if (exists(dest)) l3e.Logger.fatal(`"${chalk.blue.bold(dest)}" already exists.`)

  getResource(templateName).then((tmp) => {
    const templatePath = tmp ? tmp : templateName
    ncp(`${join(templatePath, 'template')}`, dest, () => {
      if (tmp) rm(tmp)
      l3e.Logger.success(`"${chalk.yellow.bold(templateName)}" Generated!`)
    })
  })
}
/**
 * Step 2 - get project shortcut and replace in gm7_sitepackage paths
 * @param callback
 */
function getOldProjectName(callback) {
    'use strict';

    var message = 'Step ' + step + ': What is the shortcut for your project right now ' +
        '(what is your sitepackage named)?\n',
        promptOptions;

    process.stdout.write('\n\n');
    process.stdout.write(chalk.blue.bold(message));

    // change prompt defaults
    prompt.message = '';
    prompt.delimiter = '';

    // options for user prompt
    promptOptions = {
        properties: {
            name: {
                pattern: /\b\w[a-z,0-9]{2,5}\b/,
                description: chalk.yellow('Old Project Shortcut (whitout "_sitepackage"):'),
                message: chalk.red('Shortcut must be only letters and numbers, lowercase and has 2 to 5 characters'),
                required: true
            }
        }
    };

    // start prompt process
    prompt.start();

    // Get project name properties from the user
    prompt.get(promptOptions, function(err, result) {
        oldProjectName = result.name;
        callback();
    });
}
Esempio n. 14
0
XtcGenerator.prototype.askFor = function askFor() {
	var cb = this.async();

	// welcome message
	var welcome =
			'\n' +
			chalk.yellow.bold("  _/__    _  __  ._  _ _/_  _  _  _ ") + '\n' +
			chalk.yellow.bold("></ /_   /_///_///_'/_ /   /_//_'/ /") + '\n' +
			chalk.yellow.bold("        /     |/           _/       ") + '\n\n' +
			chalk.blue.bold('    express-terrific project generator\n\n') +
			chalk.green('Please answer a few questions to create your new project.\n')
		;

	console.log(welcome);

	var prompts = [
		{
			name: 'name', message: 'What\'s the name of the new project?\n' +
			'(all lowercase, hyphen separated)'
		}
	];

	this.prompt(prompts, function (err, props) {

		if (err) {
			return this.emit('error', err);
		}

		this.name = props.name;

		cb();
	}.bind(this));
};
Esempio n. 15
0
    .then(function (template) {
      if (!options.sync && options.fetches && !templateFetchesLeft[name]) {
        console.error('Tried to fetch mention', chalk.red.bold(name), 'too many times.');
        res.send(500);
        return;
      }

      console.log(chalk.dim('At ' + (new Date()).toTimeString()), chalk.blue.bold(name), 'was fetched.');
      res.send(template);

      if (!options.sync && options.fetches) {
        templateFetchesLeft[name] -= 1;

        if (templateFetchesLeft[name] === 0) {
          delete templateFetchesLeft[name];

          if (objectEmpty(templateFetchesLeft)) {
            console.log(chalk.green('Done with all ' + count + ' pings!'), count * options.fetches, 'fetches has been done.', fails ? chalk.red(fails + ' of them failed.') : '');
            server.close();
          }
        }
      }

      if (!templates.length && !options.sync) {
        console.log(chalk.green('Done with all ' + count + ' pings!'), fails ? chalk.red(fails + ' of them failed.') : '');
        server.close();
      }
    })
Esempio n. 16
0
module.exports = function throwsHelper(error) {
	if (!error || !error._avaThrowsHelperData) {
		return;
	}

	var data = error._avaThrowsHelperData;
	var codeFrame = require('babel-code-frame');
	var frame = '';

	try {
		var rawLines = fs.readFileSync(data.filename, 'utf8');
		frame = codeFrame(rawLines, data.line, data.column, {highlightCode: true});
	} catch (e) {
		console.warn(e);
	}

	console.error(
		[
			'Improper usage of t.throws detected at ' + chalk.bold.yellow('%s (%d:%d)') + ':',
			frame,
			'The first argument to t.throws should be wrapped in a function:',
			chalk.cyan('  t.throws(function() {\n    %s\n  })'),
			'Visit the following URL for more details:',
			'  ' + chalk.blue.underline('https://github.com/avajs/ava#throwsfunctionpromise-error-message')
		].join('\n\n'),
		path.relative(globals.options.baseDir, data.filename),
		data.line,
		data.column,
		data.source
	);
};
Esempio n. 17
0
 }, function () {
   logger.status(chalk.bold('[Downloaded] ') + chalk.blue.underline(archive.key.toString('hex')))
   logger.status('', -1) // remove peer count
   printTotalStats()
   logger.logNow()
   process.exit(0)
 })
Esempio n. 18
0
server.listen(process.env.PORT || 3000, '0.0.0.0', err => {
  if (err) throw err;

  const addr = server.address();
  console.log(chalk.blue.bold('Server Started!'));
  console.log(chalk.cyan(`Listening at http://${addr.address}:${addr.port}`));
});
Esempio n. 19
0
// display a message in the command line
function log(type = 'message', message, verbose = false) {
    switch (type) {
        case 'app':
            console.log(chalk.bgRgb(230, 20, 20)(`  ${ message }  `));
            break;
        case 'dump':
            if (verbose) {
                console.log(chalk.magenta.bold(`📦 ${ JSON.stringify(message, null, 2) }`));
            }
            break;
        case 'running':
            console.log(chalk.green.bold(`💻 ${ chalk.green(message) }`));
            break;
        case 'title':
            console.log(chalk.blue.bold(`🛠 ${ message }`));
            break;
        case 'verbose':
            if (verbose) {
                console.log(chalk.keyword('orange')(`🕵 ${ message }`));
            }
            break;
        case 'warn':
            console.warn(chalk.red.bold(`🚧 ${ message }`));
            break;
        default:
            console.log(message);
    }
}
Esempio n. 20
0
 return (() => {
     console.log(chalk.blue.bold('Starting business network from archive: ')+argv.archiveFile);
     let archiveFileContents = null;
     // Read archive file contents
     archiveFileContents = Start.getArchiveFileContents(argv.archiveFile);
     return BusinessNetworkDefinition.fromArchive(archiveFileContents);
 })()
Esempio n. 21
0
 module.docs = function(text, link) {
   if (text) {
     yo.log(wrap(chalk.dim.yellow(text), size.width));
   }
   if (link) {
     yo.log(chalk.dim.green('See: ') + chalk.blue.underline(link));
   }
 }
Esempio n. 22
0
 })).then((res) => {
     countdown.stop()
     var token = tool.getToken(res.data)
     conf.set('token', token)
     resolve()
     log(
         chalk.blue.bold('登录成功')
     )
 }).catch((e) => {
Esempio n. 23
0
File: yoyo.js Progetto: Digikid13/yo
 .on('exit', function () {
   this.insight.track('yoyo', 'installed', pkgName);
   this.home({
     refresh: true,
     message:
       '\nI just installed a generator by running:\n' +
       chalk.blue.bold('\n    npm install -g ' + pkgName)
   });
 }.bind(this));
Esempio n. 24
0
 exports[service]( (error) => {
   var serviceText = chalk.blue.bold(service)
   if (error) {
     console.log(chalk.red(`[✕] ${serviceText} has not been installed : ${error}`))
   } else {
     console.log(chalk.green(`[✓] ${serviceText} has been installed:`))
   }
   done()
 })
Esempio n. 25
0
 .then(function() {
   console.log(chalk.green.bold('ember-cli-horizon') + ' has been installed along with all client dependencies.');
   console.log('  - in order to use this you will need to install the Horizon server,');
   console.log('    you can find more information here: ' + chalk.blue.underline('http://horizon.io/install/'));
   console.log();
   console.log('In development mode you can serve both Horizon server and Ember\'s "serve" by');
   console.log('using the ' + chalk.bold('ember horizon:serve') + ' command.');
   console.log();
   resolve(true);
 })
Esempio n. 26
0
 axios.post('http://robben.souche-inc.com/f2e-robben/publish/send.json', qs.stringify(data)).then((res) => {
     countdown.stop()
     if (res.data.success) {
         resolve()
         log(
             chalk.blue.bold('邮件发送成功')
         )
     }
     reject(new Error(res.data.msg))
 }).catch((e) => {
Esempio n. 27
0
 axios.get(`http://sso.souche-inc.com/PhoneCode.json?username=${phone}&isDingDing=true`).then((res) => {
     countdown.stop()
     if (res.data.success) {
         resolve()
         log(
             chalk.blue.bold('验证码发送成功')
         )
     }
     reject(res.msg)
 }).catch((e) => {
Esempio n. 28
0
yoyo.prototype._initGenerator = function _initGenerator(generator, done) {
  console.log(
      chalk.yellow('\nMake sure you are in the directory you want to scaffold into.\n')
    + 'This generator can also be run with: '
    + chalk.blue.bold('yo ' + generator.split(':')[0])
  );

  this.insight.track('yoyo', 'run', generator);
  this.env.run(generator, done);
};
Esempio n. 29
0
 gethjs.stop(function (err, code) {
     account = accounts[0];
     console.log(chalk.blue.bold("\nAccount 0: ") + chalk.cyan(account));
     options.GETH_OPTIONS.account = account;
     setTimeout(function () {
         gethjs.start(options.GETH_OPTIONS, function (err, geth) {
             init(geth, account, callback, next, ++count);
         });
     }, 5000);
 });
Esempio n. 30
0
 .then ((result) => {
     businessNetworkDefinition = result;
     businessNetworkName = businessNetworkDefinition.getIdentifier();
     console.log(chalk.blue.bold('Business network definition:'));
     console.log(chalk.blue('\tIdentifier: ')+businessNetworkName);
     console.log(chalk.blue('\tDescription: ')+businessNetworkDefinition.getDescription());
     console.log();
     adminConnection = cmdUtil.createAdminConnection();
     return adminConnection.connect(argv.connectionProfileName, argv.startId, argv.startSecret, updateBusinessNetwork ? businessNetworkDefinition.getName() : null);
 })