 events = require "events"
 colors = require "colors"
 nconf = require "nconf"
+paths = require "path"
 util = require "util"
 fs = require "fs"
 

###

_ = require "lodash"
assert = require "assert"
connect = require "connect"
moment = require "moment"

        logger.remove logger.transports.Console
        logger.add logger.transports.Console, options

    # Get a concatenated path to the unique file designed by the
    # combination of prefix and a unique identificator generated by
    # employing the UUID v4 format. If unique param is set to false
    # than the path will be set to prefix without the unique part.
    envPath: (basis, prefix, unique=uuid.v4()) ->
        dirs = nconf.get("environment:dirs") or []
        unknown = "Env dir #{basis} is not managed"
        assert _.isString(prefix), "invalid prefix"
        throw new Error unknown unless basis in dirs
        prefix = prefix + "-" + unique if unique
        return paths.join basis, prefix

    # This method is responsible for starting up the scope object.
    # This means initialization of all its necessary routines and
    # setting up whatever this scope needs to set. The default
