aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/engine.rb
diff options
context:
space:
mode:
Diffstat (limited to 'railties/lib/rails/engine.rb')
-rw-r--r--railties/lib/rails/engine.rb38
1 files changed, 15 insertions, 23 deletions
diff --git a/railties/lib/rails/engine.rb b/railties/lib/rails/engine.rb
index 39afac0604..b373b931f9 100644
--- a/railties/lib/rails/engine.rb
+++ b/railties/lib/rails/engine.rb
@@ -2,29 +2,23 @@ require 'active_support/core_ext/module/delegation'
module Rails
class Engine < Railtie
+ autoload :Configurable, "rails/engine/configurable"
+
class << self
attr_accessor :called_from
- delegate :middleware, :root, :paths, :to => :config
-
- def original_root
- @original_root ||= find_root_with_file_flag("lib")
- end
-
- def config
- @config ||= Configuration.new(original_root)
- end
def inherited(base)
- base.called_from = begin
- call_stack = caller.map { |p| p.split(':').first }
- File.dirname(call_stack.detect { |p| p !~ %r[railties/lib/rails|rack/lib/rack] })
+ unless abstract_railtie?(base)
+ base.called_from = begin
+ call_stack = caller.map { |p| p.split(':').first }
+ File.dirname(call_stack.detect { |p| p !~ %r[railties/lib/rails|rack/lib/rack] })
+ end
end
+
super
end
- protected
-
- def find_root_with_file_flag(flag, default=nil)
+ def find_root_with_flag(flag, default=nil)
root_path = self.called_from
while root_path && File.directory?(root_path) && !File.exist?("#{root_path}/#{flag}")
@@ -42,14 +36,6 @@ module Rails
delegate :middleware, :paths, :root, :to => :config
- def config
- self.class.config
- end
-
- def reloadable?(app)
- app.config.reload_plugins
- end
-
def load_tasks
super
config.paths.lib.tasks.to_a.sort.each { |ext| load(ext) }
@@ -113,5 +99,11 @@ module Rails
end
end
end
+
+ protected
+
+ def reloadable?(app)
+ app.config.reload_plugins
+ end
end
end \ No newline at end of file