Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make plugins responsible for loading their own rake tasks

Signed-off-by: Carl Lerche <carllerche@mac.com>
  • Loading branch information...
commit 468bdb3ed8ee20fe4215e62f0f27513c70e2398c 1 parent cbce027
@spohlenz spohlenz authored Carl Lerche committed
View
8 railties/lib/rails/application.rb
@@ -72,13 +72,7 @@ def reload_routes!
def load_tasks
require "rails/tasks"
- # Load all extension rake tasks
- # TODO: Make all plugin objects respond to :load_tasks
- plugins.each do |plugin|
- plugin.load_tasks if plugin.respond_to? :load_tasks
- end
- # Load all plugin tasks
- Dir["#{root}/vendor/plugins/*/**/tasks/**/*.rake"].sort.each { |ext| load ext }
+ plugins.each { |p| p.load_tasks }
# Load all application tasks
# TODO: extract out the path to the rake tasks
Dir["#{root}/lib/tasks/**/*.rake"].sort.each { |ext| load ext }
View
4 railties/lib/rails/plugin.rb
@@ -85,6 +85,10 @@ def load_paths
Dir["#{path}/{lib}", "#{path}/app/{models,controllers,helpers}"]
end
+ def load_tasks
+ Dir["#{path}/**/tasks/**/*.rake"].sort.each { |ext| load ext }
+ end
+
initializer :add_to_load_path, :after => :set_autoload_paths do |app|
load_paths.each do |path|
$LOAD_PATH << path
Please sign in to comment.
Something went wrong with that request. Please try again.