Commit eb4d0d911b550af6be3bffa0442fc2e4349dbcf1
1 parent
bc9821dc
Exists in
master
and in
29 other branches
rails3: fix plugin extensions load
Showing
1 changed file
with
7 additions
and
5 deletions
Show diff stats
lib/noosfero/plugin.rb
@@ -21,6 +21,7 @@ class Noosfero::Plugin | @@ -21,6 +21,7 @@ class Noosfero::Plugin | ||
21 | enabled.each do |plugin_dir| | 21 | enabled.each do |plugin_dir| |
22 | plugin_name = File.basename(plugin_dir) | 22 | plugin_name = File.basename(plugin_dir) |
23 | load_plugin(plugin_name) | 23 | load_plugin(plugin_name) |
24 | + load_plugin_extensions(plugin_dir) | ||
24 | end | 25 | end |
25 | end | 26 | end |
26 | 27 | ||
@@ -58,15 +59,12 @@ class Noosfero::Plugin | @@ -58,15 +59,12 @@ class Noosfero::Plugin | ||
58 | [ config.autoload_paths, $:].each do |path| | 59 | [ config.autoload_paths, $:].each do |path| |
59 | path << File.join(dir, 'models') | 60 | path << File.join(dir, 'models') |
60 | path << File.join(dir, 'lib') | 61 | path << File.join(dir, 'lib') |
61 | - path << File.join(dir, 'lib', 'ext') | ||
62 | # load vendor/plugins | 62 | # load vendor/plugins |
63 | Dir.glob(File.join(dir, '/vendor/plugins/*')).each do |vendor_plugin| | 63 | Dir.glob(File.join(dir, '/vendor/plugins/*')).each do |vendor_plugin| |
64 | path << "#{vendor_plugin}/lib" | 64 | path << "#{vendor_plugin}/lib" |
65 | init = "#{vendor_plugin}/init.rb" | 65 | init = "#{vendor_plugin}/init.rb" |
66 | require init.gsub(/.rb$/, '') if File.file? init | 66 | require init.gsub(/.rb$/, '') if File.file? init |
67 | end | 67 | end |
68 | - # load extensions | ||
69 | - #Dir[File.join(dir, 'lib', 'ext', '*.rb')].each {|file| require_dependency file } | ||
70 | end | 68 | end |
71 | 69 | ||
72 | # add view path | 70 | # add view path |
@@ -74,8 +72,12 @@ class Noosfero::Plugin | @@ -74,8 +72,12 @@ class Noosfero::Plugin | ||
74 | end | 72 | end |
75 | end | 73 | end |
76 | 74 | ||
77 | - def load_plugin(dir) | ||
78 | - (dir.to_s.camelize + 'Plugin').constantize | 75 | + def load_plugin(plugin_name) |
76 | + (plugin_name.to_s.camelize + 'Plugin').constantize | ||
77 | + end | ||
78 | + | ||
79 | + def load_plugin_extensions(dir) | ||
80 | + Dir[File.join(dir, 'lib', 'ext', '*.rb')].each {|file| require_dependency file } | ||
79 | end | 81 | end |
80 | 82 | ||
81 | def enabled | 83 | def enabled |