aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/plugin.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2009-12-29 15:46:12 -0800
committerJeremy Kemper <jeremy@bitsweat.net>2009-12-29 15:46:12 -0800
commitb27a3e8da39484d8a02d3b9c1e4dc3cb60ddcce7 (patch)
tree372a4af6df43eb8bed19c11e55b2f70907d60507 /railties/lib/rails/plugin.rb
parentada895e8cac855a2f248aafdb92457365f062d07 (diff)
parentb354496bda901cb0af499d6f3dff17a96a834a67 (diff)
downloadrails-b27a3e8da39484d8a02d3b9c1e4dc3cb60ddcce7.tar.gz
rails-b27a3e8da39484d8a02d3b9c1e4dc3cb60ddcce7.tar.bz2
rails-b27a3e8da39484d8a02d3b9c1e4dc3cb60ddcce7.zip
Merge branch 'master' of git://github.com/mikel/rails into mail
Conflicts: actionmailer/lib/action_mailer.rb
Diffstat (limited to 'railties/lib/rails/plugin.rb')
-rw-r--r--railties/lib/rails/plugin.rb27
1 files changed, 25 insertions, 2 deletions
diff --git a/railties/lib/rails/plugin.rb b/railties/lib/rails/plugin.rb
index 86bf032641..0699affea7 100644
--- a/railties/lib/rails/plugin.rb
+++ b/railties/lib/rails/plugin.rb
@@ -2,6 +2,29 @@ module Rails
class Plugin
include Initializable
+ def self.plugin_name(plugin_name = nil)
+ @plugin_name ||= name.demodulize.underscore
+ @plugin_name = plugin_name if plugin_name
+ @plugin_name
+ end
+
+ def self.inherited(klass)
+ @plugins ||= []
+ @plugins << klass unless klass == Vendored
+ end
+
+ def self.plugins
+ @plugins
+ end
+
+ def self.plugin_names
+ plugins.map { |p| p.plugin_name }
+ end
+
+ def self.config
+ Configuration.default
+ end
+
class Vendored < Plugin
def self.all(list, paths)
plugins = []
@@ -55,8 +78,8 @@ module Rails
initializer :add_routing_file, :after => :initialize_routing do |app|
routing_file = "#{path}/config/routes.rb"
if File.exist?(routing_file)
- app.routes.add_configuration_file(routing_file)
- app.routes.reload!
+ app.route_configuration_files << routing_file
+ app.reload_routes!
end
end
end