Skip to content

Commit

Permalink
Merge pull request #1733 from SAP-Oxygen/master-plugins_in_engine_patch
Browse files Browse the repository at this point in the history
Cherry-picking patch for #1460 from 3-1-stable to master
  • Loading branch information
josevalim committed Jun 16, 2011
2 parents 8854288 + 245dba0 commit b9fa32c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
6 changes: 0 additions & 6 deletions railties/lib/rails/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,6 @@ def require_environment! #:nodoc:
require environment if environment
end

def eager_load! #:nodoc:
railties.all(&:eager_load!)
super
end

def reload_routes!
routes_reloader.reload!
Expand All @@ -100,14 +96,12 @@ def initialize!

def load_tasks(app=self)
initialize_tasks
railties.all { |r| r.load_tasks(app) }
super
self
end

def load_console(app=self)
initialize_console
railties.all { |r| r.load_console(app) }
super
self
end
Expand Down
12 changes: 10 additions & 2 deletions railties/lib/rails/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -395,12 +395,20 @@ def find(path)
delegate :middleware, :root, :paths, :to => :config
delegate :engine_name, :isolated?, :to => "self.class"

def load_tasks(*)
def load_tasks(app=self)
railties.all { |r| r.load_tasks(app) }
super
paths["lib/tasks"].existent.sort.each { |ext| load(ext) }
end


def load_console(app=self)
railties.all { |r| r.load_console(app) }
super
end

def eager_load!
railties.all(&:eager_load!)

config.eager_load_paths.each do |load_path|
matcher = /\A#{Regexp.escape(load_path)}\/(.*)\.rb\Z/
Dir.glob("#{load_path}/**/*.rb").sort.each do |file|
Expand Down

0 comments on commit b9fa32c

Please sign in to comment.