mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Merge branch 'master' of github.com:rails/rails
This commit is contained in:
@@ -72,13 +72,7 @@ module Rails
|
||||
|
||||
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 }
|
||||
@@ -98,7 +92,7 @@ module Rails
|
||||
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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user