Sha256: 76c5ce73b2daf2016d6a3b92c6de78fe96feed6889274bcc5bf6979e9b34c5eb

Contents?: true

Size: 963 Bytes

Versions: 3

Compression:

Stored size: 963 Bytes

Contents

##
#  Functions almost exactly like the standard Rails::Plugin::GemLocator,
#  but will not return gems that conform to Radiant extensions.
#  See radiant/extension_locator for the plugin locator that handles extensions.

module Radiant
  class GemLocator < Rails::Plugin::GemLocator
    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
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
radiant-1.0.0.rc2 lib/radiant/gem_locator.rb
radiant-1.0.0.rc1 lib/radiant/gem_locator.rb
radiant-rails3-0.1 lib/radiant/gem_locator.rb