#!/usr/bin/env node

/**
 * Run all apeman apps in this project.
 *
 * Generated by {{generator}} on {{today}},
 * from a template provided by {{ pkg.name }}.
 */

'use strict'

process.chdir(`${__dirname}/{{{cwd}}}`)

const co = require('co')

let apps = [
{{#each params.apps}}  require('./{{snakecase this}}_app.js'){{#if @last}}{{else}},
{{/if}}{{/each}}
]

/** Start all apps */
function all() {
  return co(function * () {
    for (let app of apps) {
      yield app()
    }
  })
}

module.exports = all

// Start when executed as main
if (!module.parent) {
  all().then(() => {
    // All started.
  })
}