Class: Engines::Plugin::GemLocator

Inherits:
Rails::Plugin::GemLocator
  • Object
show all
Defined in:
lib/engines/plugin/locator.rb

Overview

FIXME Rails GemLocator requires refactoring

Instance Method Summary collapse

Instance Method Details

#pluginsObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/engines/plugin/locator.rb', line 12

def plugins
  # FIXME think of it more
  specs = initializer.configuration.gems.map(&:specification) + 
          Gem.loaded_specs.values

  # FIXME it should be in rails too
  # Remove not installed gems specs to allow run rake gems:install
  specs.compact!

  # FIXME think of it more         
  specs.reject! { |spec| !spec.loaded_from ||
                         !File.exist?(File.join(spec.full_gem_path, "rails", "init.rb"))}

  require "rubygems/dependency_list"

  deps = Gem::DependencyList.new
  deps.add(*specs) unless specs.empty?

  deps.dependency_order.collect do |spec|
    Engines::GemPlugin.new(spec)
  end
end