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


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

  load: (callback) ->
    componentsFromDirectory @options.componentdir, @options.config, (err, components) =>
      return callback err if err
      for k,v of components
        @components[k] = v
      for k,v of componentsFromConfig @options.config
        @components[k] = v
      return callback null

  getSource: (name, callback) ->


  return config

class Library extends EventEmitter
  constructor: (options) ->
    options.config = JSON.parse(fs.readFileSync options.configfile, 'utf-8') if options.configfile
    options.componentdir = 'participants' if not options.componentdir
