cli/index.js
function generate (generatorName, name, flags) {
  let generator

  switch (generatorName) {
    case 'app':
      generator = new generators.App(name)
      break
    case 'controller':
      generator = new generators.Controller(name, flags)
      break
    case 'model':
      generator = new generators.Model(name, flags)
      break
    case 'view':
      console.log(`generating view ${name} ...`)
      console.log('NotImplemented. View generation not yet available')
      break
    case 'migration':
      generator = new generators.Migration(name, flags)
      break
    case 'scaffold':
      console.log(`generating scaffold ${name} ...`)
      console.log('NotImplemented. Scaffold generation not yet available')
      break
    case 'user':
      console.log(`generating user ${name} ...`)
      console.log('NotImplemented. User generation not yet available')
      break
    default:
      if (!name) {
        return generate('app', generatorName)
      }
  }

  if (!generator) {
    return cli.showHelp(0)
  }

  return generator.run()
}
function generate (generatorName, name, flags) {
  let generator

  switch (generatorName) {
    case 'app':
      generator = new generators.App(name)
      break
    case 'controller':
      generator = new generators.Controller(name, flags)
      break
    case 'model':
      generator = new generators.Model(name, flags)
      break
    case 'view':
      console.log(`generating view ${name} ...`)
      console.log('NotImplemented. View generation not yet available')
      break
    case 'migration':
      generator = new generators.Migration(name, flags)
      break
    case 'scaffold':
      console.log(`generating scaffold ${name} ...`)
      console.log('NotImplemented. Scaffold generation not yet available')
      break
    case 'user':
      console.log(`generating user ${name} ...`)
      console.log('NotImplemented. User generation not yet available')
      break
    default:
      if (!name) {
        return generate('app', generatorName)
      }
  }

  if (!generator) {
    return cli.showHelp(0)
  }

  return generator.run()
}
function generate ( generatorName , name , flags ) { let generator switch ( generatorName ) { case 'app' : generator = new generators . App ( name ) break case 'controller' : generator = new generators . Controller ( name , flags ) break case 'model' : generator = new generators . Model ( name , flags ) break case 'view' : console . log ( ` ${ name } ` ) console . log ( 'NotImplemented. View generation not yet available' ) break case 'migration' : generator = new generators . Migration ( name , flags ) break case 'scaffold' : console . log ( ` ${ name } ` ) console . log ( 'NotImplemented. Scaffold generation not yet available' ) break case 'user' : console . log ( ` ${ name } ` ) console . log ( 'NotImplemented. User generation not yet available' ) break default : if ( ! name ) { return generate ( 'app' , generatorName ) } } if ( ! generator ) { return cli . showHelp ( 0 ) } return generator . run ( ) }
Run a given generator

@param {String} generatorName - The name of the generator to run
@param {String} name - The name of the generated item
@param {Object} flags - The flags passed to the generator
Run a given generator