 path = require 'path-extra'
 semver = require 'semver'
 npm = require 'npm'
+async = Promise.coroutine
 
 fs = Promise.promisifyAll require 'fs-extra'
 

      return false
    return config.get "plugin.#{plugin.name}.enable", true

  # get the lastest version of plugin based on npm
  # @param {Plugin}
  # @return {Promise<?string>}
  getLastestVersionOfPlugin: (plugin) ->
    # after getting mirrors, at least one mirror is set
    @getMirrors().then ->
      new Promise (resolve) ->
        npm.commands.distTag ['ls', plugin.packageName], (err, data) ->
          resolve data or null

  # update one plugin
  # @param {Plugin} plugin
  # @return {Promise<>}
  updatePlugin: (plugin) ->
    plugin.isUpdating = true
    @getMirrors().then ->
      new Promise (resolve) ->
        npm.commands.install ["#{plugins[index].packageName}@#{plugin.version}"], ->
        plugin.isUpdating = false
        resolve()

  # install one plugin and read it
  # @param {string} name

        npm.load npmConfig, =>
          resolve @config_

  # get the current plugins
  # @return {Promise<Array<Plugin>>}
  getPlugins: ->
