Commit eb4d0d911b550af6be3bffa0442fc2e4349dbcf1
1 parent
bc9821dc
Exists in
master
and in
27 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 | 21 | enabled.each do |plugin_dir| |
22 | 22 | plugin_name = File.basename(plugin_dir) |
23 | 23 | load_plugin(plugin_name) |
24 | + load_plugin_extensions(plugin_dir) | |
24 | 25 | end |
25 | 26 | end |
26 | 27 | |
... | ... | @@ -58,15 +59,12 @@ class Noosfero::Plugin |
58 | 59 | [ config.autoload_paths, $:].each do |path| |
59 | 60 | path << File.join(dir, 'models') |
60 | 61 | path << File.join(dir, 'lib') |
61 | - path << File.join(dir, 'lib', 'ext') | |
62 | 62 | # load vendor/plugins |
63 | 63 | Dir.glob(File.join(dir, '/vendor/plugins/*')).each do |vendor_plugin| |
64 | 64 | path << "#{vendor_plugin}/lib" |
65 | 65 | init = "#{vendor_plugin}/init.rb" |
66 | 66 | require init.gsub(/.rb$/, '') if File.file? init |
67 | 67 | end |
68 | - # load extensions | |
69 | - #Dir[File.join(dir, 'lib', 'ext', '*.rb')].each {|file| require_dependency file } | |
70 | 68 | end |
71 | 69 | |
72 | 70 | # add view path |
... | ... | @@ -74,8 +72,12 @@ class Noosfero::Plugin |
74 | 72 | end |
75 | 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 | 81 | end |
80 | 82 | |
81 | 83 | def enabled | ... | ... |