diff options
author | Jean-Baptiste Barth <jeanbaptiste.barth@gmail.com> | 2013-05-02 17:59:34 +0000 |
---|---|---|
committer | Jean-Baptiste Barth <jeanbaptiste.barth@gmail.com> | 2013-05-02 17:59:34 +0000 |
commit | e771d68214e7a83b7a4986e91faf5db15a04374a (patch) | |
tree | 6d18a8232de673e09fd5a5008457e744714a965c /lib/redmine/plugin.rb | |
parent | 501007f01d0d7b41ec78455ee29b989e523fb32b (diff) | |
download | redmine-e771d68214e7a83b7a4986e91faf5db15a04374a.tar.gz redmine-e771d68214e7a83b7a4986e91faf5db15a04374a.zip |
Allow plugins to define their base directory (#13927).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11766 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine/plugin.rb')
-rw-r--r-- | lib/redmine/plugin.rb | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/redmine/plugin.rb b/lib/redmine/plugin.rb index 30c182d17..8eb1c078d 100644 --- a/lib/redmine/plugin.rb +++ b/lib/redmine/plugin.rb @@ -64,15 +64,18 @@ module Redmine #:nodoc: end end end - def_field :name, :description, :url, :author, :author_url, :version, :settings + def_field :name, :description, :url, :author, :author_url, :version, :settings, :directory attr_reader :id # Plugin constructor def self.register(id, &block) p = new(id) p.instance_eval(&block) + # Set a default name if it was not provided during registration p.name(id.to_s.humanize) if p.name.nil? + # Set a default directory if it was not provided during registration + p.directory(File.join(self.directory, id.to_s)) if p.directory.nil? # Adds plugin locales if any # YAML translation files should be found under <plugin>/config/locales/ @@ -137,10 +140,6 @@ module Redmine #:nodoc: @id = id.to_sym end - def directory - File.join(self.class.directory, id.to_s) - end - def public_directory File.join(self.class.public_directory, id.to_s) end |