Method: MGit::PluginManager.load_local_plugins

Defined in:
lib/m-git/plugin_manager.rb

.load_local_plugins(plugin_prefix, plugin_root, with_name = nil) ⇒ Object

加载单个本地插件



58
59
60
61
62
63
64
65
66
# File 'lib/m-git/plugin_manager.rb', line 58

def self.load_local_plugins(plugin_prefix, plugin_root, with_name = nil)
  with_name ||= plugin_root
  glob = "#{plugin_prefix}_plugin#{Gem.suffix_pattern}"
  glob = File.join(plugin_root, '**', glob)
  plugin_files = Dir[glob]
  return if loaded_plugins[with_name] || plugin_files.nil? || plugin_files.empty?
  safe_activate_plugin_files(with_name, plugin_files)
  loaded_plugins[with_name] = plugin_files
end