Class: Radiant::GemLocator

Inherits:
Rails::Plugin::GemLocator
  • Object
show all
Defined in:
lib/radiant/gem_locator.rb

Instance Method Summary collapse

Instance Method Details

#pluginsObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/radiant/gem_locator.rb', line 8

def plugins
  gem_index = initializer.configuration.gems.inject({}) { |memo, gem| memo.update gem.specification => gem }
  specs     = gem_index.keys
  specs    += Gem.loaded_specs.values.select do |spec|
    spec.loaded_from && # prune stubs
      File.exist?(File.join(spec.full_gem_path, "rails", "init.rb"))
  end
  specs.compact!
  specs.reject! { |s| s.name =~ /^radiant-.*-extension$/ }

  require "rubygems/dependency_list"

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

  deps.dependency_order.collect do |spec|
    Rails::GemPlugin.new(spec, gem_index[spec])
  end
end