diff options
Diffstat (limited to 'railties/lib/rails/railtie.rb')
-rw-r--r-- | railties/lib/rails/railtie.rb | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/railties/lib/rails/railtie.rb b/railties/lib/rails/railtie.rb index a06be59759..1cb99463cc 100644 --- a/railties/lib/rails/railtie.rb +++ b/railties/lib/rails/railtie.rb @@ -181,33 +181,35 @@ module Rails def eager_load! end - def load_console(app=self) + def railtie_namespace + @railtie_namespace ||= self.class.parents.detect { |n| n.respond_to?(:railtie_namespace) } + end + + protected + + def run_console_blocks(app) #:nodoc: self.class.console.each { |block| block.call(app) } end - def load_runner(app=self) + def run_generators_blocks(app) #:nodoc: + self.class.generators.each { |block| block.call(app) } + end + + def run_runner_blocks(app) #:nodoc: self.class.runner.each { |block| block.call(app) } end - def load_tasks(app=self) - require 'rake' + def run_tasks_blocks(app) #:nodoc: extend Rake::DSL - self.class.rake_tasks.each { |block| self.instance_exec(app, &block) } + self.class.rake_tasks.each { |block| instance_exec(app, &block) } - # load also tasks from all superclasses + # Load also tasks from all superclasses klass = self.class.superclass + while klass.respond_to?(:rake_tasks) - klass.rake_tasks.each { |t| self.instance_exec(app, &t) } + klass.rake_tasks.each { |t| instance_exec(app, &t) } klass = klass.superclass end end - - def load_generators(app=self) - self.class.generators.each { |block| block.call(app) } - end - - def railtie_namespace - @railtie_namespace ||= self.class.parents.detect { |n| n.respond_to?(:railtie_namespace) } - end end end |