diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2008-03-27 18:37:53 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2008-03-27 18:37:53 +0000 |
commit | 8301ce4d0b9de4423b74abf842faa6cf9e5aae1b (patch) | |
tree | e22d7df34571655992cd160d7cce829f980f820d /railties/lib/rails/plugin | |
parent | 60809439509e071d9c9a6b6f1b2051fa6902985a (diff) | |
download | rails-8301ce4d0b9de4423b74abf842faa6cf9e5aae1b.tar.gz rails-8301ce4d0b9de4423b74abf842faa6cf9e5aae1b.tar.bz2 rails-8301ce4d0b9de4423b74abf842faa6cf9e5aae1b.zip |
Added that gems can now be plugins if they include rails/init.rb (closes #11444) [jbarnette]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9101 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties/lib/rails/plugin')
-rw-r--r-- | railties/lib/rails/plugin/locator.rb | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/railties/lib/rails/plugin/locator.rb b/railties/lib/rails/plugin/locator.rb index b27e904b12..0b7923cfb6 100644 --- a/railties/lib/rails/plugin/locator.rb +++ b/railties/lib/rails/plugin/locator.rb @@ -72,7 +72,26 @@ module Rails plugins end end - + end + + # The GemLocator scans all the loaded RubyGems, looking for gems with + # a <tt>rails/init.rb</tt> file. + class GemLocator < Locator + def plugins + 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 + + require "rubygems/dependency_list" + + deps = Gem::DependencyList.new + deps.add(*specs) + + deps.dependency_order.collect do |spec| + Rails::GemPlugin.new(spec) + end + end end end end
\ No newline at end of file |