 fs = require 'fs'
 path = require 'path'
 debug = require('debug')('msgflo:library')
+EventEmitter = require('events').EventEmitter
 
 common = require './common'
 


    fs.writeFile filename, code, (err) =>
      return callback err if err
      @components[name] =
        language: language
        command: componentCommandForFile @options.config, filename
      return callback null

  componentCommand: (component, role, iips={}) ->


    @components = {} # "name" -> { command: "", language: ''|null }.  lazy-loaded using load()

  _updateComponents: (components) ->
    names = Object.keys components
    for name, comp of components
      @components[name] = comp
    @emit 'components-changed', names, @components

  load: (callback) ->
    componentsFromDirectory @options.componentdir, @options.config, (err, components) =>
      return callback err if err
      @_updateComponents components
      @_updateComponents componentsFromConfig(@options.config)
      return callback null

  getSource: (name, callback) ->
