aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/plugin.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2009-12-29 15:38:17 -0800
committerJeremy Kemper <jeremy@bitsweat.net>2009-12-29 15:38:17 -0800
commit485d244eaec09579d4fcf024c51d9aa05c930f33 (patch)
tree9e54b0d5f245e6775e9c2c5b714ba557cc77ce1a /railties/lib/rails/plugin.rb
parent0b375725526a2d1d952938610a66291f00849713 (diff)
parent468bdb3ed8ee20fe4215e62f0f27513c70e2398c (diff)
downloadrails-485d244eaec09579d4fcf024c51d9aa05c930f33.tar.gz
rails-485d244eaec09579d4fcf024c51d9aa05c930f33.tar.bz2
rails-485d244eaec09579d4fcf024c51d9aa05c930f33.zip
Merge branch 'master' of github.com:rails/rails
Diffstat (limited to 'railties/lib/rails/plugin.rb')
-rw-r--r--railties/lib/rails/plugin.rb17
1 files changed, 13 insertions, 4 deletions
diff --git a/railties/lib/rails/plugin.rb b/railties/lib/rails/plugin.rb
index be6cdec3fa..c64042cf7d 100644
--- a/railties/lib/rails/plugin.rb
+++ b/railties/lib/rails/plugin.rb
@@ -27,12 +27,17 @@ module Rails
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.
@@ -80,6 +85,10 @@ module Rails
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