 ChildProcess = require './ChildProcess'
 EventEmitter = require('events').EventEmitter
 glob = require("glob")
+
 
 
 class Meteor extends EventEmitter

      @emit "error"


  hasReadyText: ( buffer )=>
    if buffer.lastIndexOf( @testPackagesOpts()["meteor-ready-text"] ) isnt -1
      @emit "ready"

  kill:->
    @childProcess?.child?.kill()


module.exports = Meteor


    stderr:""
  }



  # It is a function not an object because of design for testability, so we can modify process.env before each tests.
  defaultOpts: ->
    {
      "port"        : process.env.PORT || 4096
      "root-url"    : process.env.ROOT_URL || Meteor.getDefaultRootUrl()
      "mongo-url"   : process.env.MONGO_URL || null
      "settings"    : null
      "production"  : false
      "once"        : false
    }



  runOpts: ->
  {

  }



  # See defaultOpts why it is a function an not an object.
  testPackagesOpts: ->
    {
      "app": null
      "driver-package": "test-in-console"
      "app-packages": true #TODO Add Support for testing all packages within an app that are not symlinks
      "timeout": 120000 # 2 minutes
      "meteor-ready-text": "=> App running at:"
      "meteor-error-text": "Waiting for file change."
    }



  @exec: ->
