Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions lib/redmine/plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down