   # @param {Plugin} plugin
   enablePlugin: (plugin) ->
     config.set "plugin.#{plugin.name}.enable", true
+    @loadPlugin(plugin)
 
   # disable one plugin
   # @param {Plugin} plugin
   disablePlugin: (plugin) ->
     config.set "plugin.#{plugin.name}.enable", false
+    @unloadPlugin(plugin)
+
+  # load one plugin
+  # @param {Plugin} plugin
+  loadPlugin: (plugin) ->
+    if plugin?.pluginDidLoad? then plugin.pluginDidLoad()
+
+  # unload one plugin
+  # @param {Plugin} plugin
+  unloadPlugin: (plugin) ->
+    if plugin.pluginShouldUnload? then plugin.pluginShouldUnload()
+
+  removePlugin: (plugin) ->
+    delete require.cache[require.resolve plugin.pluginPath]
+    for plugin_, index in @plugins_
+      if plugin.packageName == plugin_.packageName
+        @plugins_.splice(index, 1)
+        break
+
+  addPlugin: (pluginPath) ->
+    plugin = @readPlugin_ pluginPath
+    @plugins_.push plugin
+    @plugins_ = _.sortBy @plugins_, 'priority'
+    if config.get "plugin.#{plugin.name}.enable", true
+      @loadPlugin(plugin)
+
+  reloadPlugin: (plugin) ->
+    @unloadPlugin(plugin)
+    newPlugin = {}
+    delete require.cache[require.resolve plugin.pluginPath]
+    for plugin_, index in @plugins_
+      if plugin.packageName == plugin_.packageName
+        newPlugin = @readPlugin_ plugin.pluginPath
+        @plugins_[index] = newPlugin
+        break
+    if config.get "plugin.#{newPlugin.name}.enable", true
+      @loadPlugin(newPlugin)
+    @plugins_ = _.sortBy @plugins_, 'priority'
 
   # read a plugin from file system
   # @param {string} pluginPath path to a plugin directory

    yield @getMirrors()
    try
      yield Promise.promisify(npm.commands.uninstall)([plugin.packageName])
      for plugin_, index in @plugins_
        if plugin.packageName is plugin_.packageName
          @plugins_.splice(index, 1)
          break
    catch error
      console.log "uninstallPlugin error: #{error}"
      console.log error.stack

        plugin = readPlugins.find (plugin_) -> packName == plugin_.packageName
        if plugin?
          # If the installed plugin is one of the existing plugins
          if plugin.version != packVersion
            @reloadPlugin(plugin)
        else
          # If the installed plugin is a new plugin
          @addPlugin(path.join @pluginPath, 'node_modules', packName)
          break
      @plugins_ = _.sortBy @plugins_, 'priority'
    catch error
