aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/plugin.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2008-11-26 20:03:25 +0100
committerDavid Heinemeier Hansson <david@loudthinking.com>2008-11-26 20:03:25 +0100
commit4999d52e08a02ebba344f6c318f0af4b5b18f0e5 (patch)
treef0d2af329fb961b6619ee5f2c21666168f8bb321 /railties/lib/rails/plugin.rb
parent40b40c487040d9c721d486e8ec8cfbc53a8cd79a (diff)
downloadrails-4999d52e08a02ebba344f6c318f0af4b5b18f0e5.tar.gz
rails-4999d52e08a02ebba344f6c318f0af4b5b18f0e5.tar.bz2
rails-4999d52e08a02ebba344f6c318f0af4b5b18f0e5.zip
Added that config/routes.rb files in engine plugins are automatically loaded (and reloaded when they change in dev mode) [DHH]
Diffstat (limited to 'railties/lib/rails/plugin.rb')
-rw-r--r--railties/lib/rails/plugin.rb23
1 files changed, 21 insertions, 2 deletions
diff --git a/railties/lib/rails/plugin.rb b/railties/lib/rails/plugin.rb
index 3b9e7dec2d..2b1e877e2b 100644
--- a/railties/lib/rails/plugin.rb
+++ b/railties/lib/rails/plugin.rb
@@ -40,7 +40,7 @@ module Rails
load_paths << app_paths if has_app_directory?
end.flatten
end
-
+
# Evaluates a plugin's init.rb file.
def load(initializer)
return if loaded?
@@ -60,7 +60,26 @@ module Rails
def about
@about ||= load_about_information
end
+
+ # Engines are plugins with an app/ directory.
+ def engine?
+ has_app_directory?
+ end
+ # Returns true if the engine ships with a routing file
+ def routed?
+ File.exist?(routing_file)
+ end
+
+ def controller_path
+ File.join(directory, 'app', 'controllers')
+ end
+
+ def routing_file
+ File.join(directory, 'config', 'routes.rb')
+ end
+
+
private
def load_about_information
about_yml_path = File.join(@directory, "about.yml")
@@ -82,7 +101,7 @@ module Rails
File.join(directory, 'app', 'helpers')
]
end
-
+
def lib_path
File.join(directory, 'lib')
end