   @package: _package = require "../package.json"
   @version: _package.version
 
-console.log "neptune-namespaces global defined: self.Neptune"
+Base.namespace = Neptune

      @[k] = v

  @addModules: (map) ->
    @modules = [] unless @hasOwnProperty "modules"
    if @hasOwnProperty "moduleNames"
      console.log("NeptuneNamespaces: alread have moduleNames for #{@getName()}")
    else
      console.log("NeptuneNamespaces: create moduleNames for #{@getName()}")
      @moduleNames = []

    for name, module of map
      @moduleNames.push name
      @modules.push module
      @_setChildNamespace name, module
      @[name] = module unless name.match /^-/
    @


  @namespacePath: "Neptune.Base"
  @namespace: null
  @allNamespaces: {}
  @subNamespaces: []
  @modules: []
  @moduleNames: []
  @_name: "Base"

  @initAsSubNamespace: (name, @namespace) ->
    @_name = name
    @modules = []
    @moduleNames = []
    @subNamespaces = []
    @namespace[name] = @
    @namespace.subNamespaces.push @
    @

  @getName: ->
    @_name || @name

  @getInspectedObjects: (includeModules = true)->
    out = {}
    out.version = @version if @version
    for namespace in @subNamespaces
      out[namespace.getName()] = namespace.getInspectedObjects includeModules
    # for mod in @moduleNames
    #   out[mod] = true
    out.modules = @moduleNames.join ' ' if includeModules && @moduleNames.length > 0
    out

  # OUT: namespace
