cirandas.net

commit 413bcb428f34d5cefcef6e06f2dcda625ea1aae4

Author: Braulio Bhavamitra <braulio@prout.io>

Initial support for plugin as engines (code inside app)

 config/routes/50_plugins.rb | 4 ++--


diff --git a/config/routes/50_plugins.rb b/config/routes/50_plugins.rb
index a159529c8a82cb715d0b9f31c29225966f2b604e..dffe48a6dddcc132fb58edfdc23576532d6d598b 100644
--- a/config/routes/50_plugins.rb
+++ b/config/routes/50_plugins.rb
@@ -1,6 +1,7 @@
 paths              = {}
 profile_format     = /#{Noosfero.identifier_format}/i
 plugins_root       = if Rails.env.test? then 'plugins' else '{baseplugins,config/plugins}' end
+controllers_paths  = "#{Rails.root}/#{plugins_root}/*/{app/,}controllers"
 prefixes_by_folder = {
   public:    'plugin',
   profile:   'profile(/:profile)/plugin',
@@ -8,7 +9,7 @@   myprofile: 'myprofile(/:profile)/plugin',
   admin:     'admin/plugin',
 }
 
-Dir.glob Rails.root.join plugins_root, '*', 'controllers' do |controllers_dir|
+Dir[controllers_paths].each do |controllers_dir|
   plugin_name = File.basename File.dirname controllers_dir
 
   controllers_by_folder = prefixes_by_folder.keys.inject({}) do |hash, folder|
@@ -18,7 +19,6 @@       filename.gsub(path, '').gsub(/[_\/]controller.rb$/, '')
     end
     hash
   end
-
 
   controllers_by_folder.each do |folder, controllers|
     controllers.each do |controller|