 				stat = fs.statSync cwd + '/plugins/' + pluginname
 				if stat.isDirectory()
 					pluginsEngine.load pluginname
+			if global_interface?
+				loadPlugin(global_interface)
 			return callback false
 
 	pluginsEngine.list = (callback) ->

		env.hooks[name] ?= []
		env.hooks[name].push fn

	pluginsEngine.load = (plugin_name) ->
		env.debug "Loading '" + plugin_name + "'."
		try 
			plugin_data = require(env.pluginsEngine.cwd + '/plugins/' + plugin_name + '/plugin.json')
		catch
			env.debug 'Absent plugin.json for plugin \'' + plugin_name + '\'.'
			plugin_data = {}
		if plugin_data.main?
			entry_point = '/' + plugin_data.main
		else
			entry_point = '/index'
		try
			plugin = require(env.pluginsEngine.cwd + '/plugins/' + plugin_name + entry_point)(env)
			env.config.plugins.push plugin_name
			pluginsEngine.plugin[plugin_name] = plugin
		catch e
			env.debug "Error requiring plugin \'" + plugin_name + "\' entry point."
		return

	pluginsEngine.init = (cwd, callback) ->
		env.pluginsEngine.cwd = cwd

async = require 'async'
jf = require 'jsonfile'
fs = require 'fs'
colors = require 'colors'

module.exports = (env) ->
	env.debug 'Initializing plugins engine'
