Source

atlas-connect / bin / atlas-connect

Full commit
#!/usr/bin/env node
var updateNotifier = require('update-notifier')
  , path = require('path')
  , render = require(path.join(__dirname, 'templates'))
  , pkg = require(path.join(__dirname, '..', 'package.json'))
  , validateCommand = require(path.join(__dirname, 'validateCommand'))
  , generateScaffold = require(path.join(__dirname, 'generator'))
  , generateKeys = require(path.join(__dirname, 'keygen'));

var notifier = updateNotifier({
  packageName: pkg.name,
  packageVersion: pkg.version
});
if (notifier.update) {
  notifier.notify(render('update-notification',notifier.update));
  return;
}

var argv = require('optimist')
  .usage(render('usage'))
  .describe('h','Show usage')
  .alias('h','help')
  .check(validateCommand)
  .argv;

var cmd = argv._[0];
var params = argv._.slice(1);

switch(cmd){
  case "new":
    generateScaffold(params[0], argv.t, function(err){
      if (!err) {
        if (argv.t !== 'hipchat'){
          generateKeys(path.join(process.cwd(),params[0]));
        }
      } else {
        console.log(err);
      }
    });
    break;
  case "keygen":
    generateKeys();
    break
}