Skip to content
Browse files

Application object should instantiate non-vendored plugins

Signed-off-by: Carl Lerche <carllerche@mac.com>
  • Loading branch information...
1 parent 2e87196 commit cbce027669ded4e951af3124cae23d6707357aea @spohlenz spohlenz committed with Carl Lerche Dec 27, 2009
Showing with 10 additions and 5 deletions.
  1. +1 −1 railties/lib/rails/application.rb
  2. +9 −4 railties/lib/rails/plugin.rb
View
2 railties/lib/rails/application.rb
@@ -98,7 +98,7 @@ def initializers
def plugins
@plugins ||= begin
plugin_names = config.plugins || [:all]
- Plugin.plugins.select { |p| plugin_names.include?(:all) || plugin_names.include?(p.plugin_name) } +
+ Plugin.plugins.select { |p| plugin_names.include?(:all) || plugin_names.include?(p.plugin_name) }.map { |p| p.new } +
Plugin::Vendored.all(config.plugins || [:all], config.paths.vendor.plugins)
end
end
View
13 railties/lib/rails/plugin.rb
@@ -27,12 +27,17 @@ def self.config
def self.rake_tasks(&blk)
@rake_tasks ||= []
- @rake_tasks << blk
+ @rake_tasks << blk if blk
+ @rake_tasks
end
- def self.load_tasks
- return unless @rake_tasks
- @rake_tasks.each { |blk| blk.call }
+ def rake_tasks
+ self.class.rake_tasks
+ end
+
+ def load_tasks
+ return unless rake_tasks
+ rake_tasks.each { |blk| blk.call }
end
# Creates an initializer which includes all given modules to the given class.

0 comments on commit cbce027

Please sign in to comment.
Something went wrong with that request. Please try again.