Method: MGit::PluginManager.load_gem_plugins
- Defined in:
- lib/m-git/plugin_manager.rb
.load_gem_plugins(plugin_prefix) ⇒ Object
加载已安装的gem插件
70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/m-git/plugin_manager.rb', line 70 def self.load_gem_plugins(plugin_prefix) glob = "#{plugin_prefix}_plugin#{Gem.suffix_pattern}" gem_plugins = Gem::Specification.latest_specs.map do |spec| spec = spec.to_spec unless spec.is_a?(Gem::Specification) matches = spec.matches_for_glob(glob) [spec, matches] unless matches.empty? end.compact gem_plugins.map do |spec, paths| next if loaded_plugins[spec.name] safe_activate_gem(spec, paths) loaded_plugins[spec.full_name] = paths end end |