diff --git a/lib/redmine/plugin.rb b/lib/redmine/plugin.rb index 11255e02d3a..0adc641e471 100644 --- a/lib/redmine/plugin.rb +++ b/lib/redmine/plugin.rb @@ -63,6 +63,15 @@ def def_field(*names) # Plugin constructor def self.register(id, &block) + # check if the plugin is in the correct location + unless Engines.plugins.collect(&:name).include? id + if Redmine::VERSION::MAJOR <= 1 && Redmine::VERSION::MINOR < 1 + ActiveSupport::Deprecation.warn "WARNING: The #{id} plugin needs to be inside #{File.join(RAILS_ROOT, 'vendor', 'plugins', id.to_s)}" + else + raise "ERROR: The #{id} plugin needs to be inside #{File.join(RAILS_ROOT, 'vendor', 'plugins', id.to_s)}" + end + end + p = new(id) p.instance_eval(&block) # Set a default name if it was not provided during registration