Sha256: 8a33ddc06a9a651c348e431010f25da7f0bdbab16a0c264f0f79a4a067d214e7

Contents?: true

Size: 857 Bytes

Versions: 2

Compression:

Stored size: 857 Bytes

Contents

##
#  Locates gems that conform to Radiant extensions. We can't let Rails treat
#  these as regular Rails::GemPlugins, because then they are handled as engines
#  and engine load paths are always lowest priority. Extension load paths
#  need to be higher than Radiant's own.

module Radiant
  class ExtensionLocator < Rails::Plugin::GemLocator
    def plugins
      gem_index = initializer.configuration.gems.inject({}) { |memo, gem| memo.update gem.specification => gem }
      specs = gem_index.keys.select do |spec|
        spec && spec.loaded_from && spec.name =~ /^radiant-.*-extension$/
      end.compact

      require "rubygems/dependency_list"

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

      deps.dependency_order.collect do |spec|
        ExtensionGem.new(spec, gem_index[spec])
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
radiant-1.0.0.rc2 lib/radiant/extension_locator.rb
radiant-1.0.0.rc1 lib/radiant/extension_locator.rb