diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-11-18 12:14:41 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2016-11-18 12:14:41 +0000 |
commit | 7a9a22f3dd62ab4c1257db38f9b8c923bdcc4c8c (patch) | |
tree | 67e4713bd1bccbb0e81de2082d9da69046c6f523 | |
parent | 1f1e65cd4b92044638e132d8c0324b45b960f090 (diff) | |
download | redmine-7a9a22f3dd62ab4c1257db38f9b8c923bdcc4c8c.tar.gz redmine-7a9a22f3dd62ab4c1257db38f9b8c923bdcc4c8c.zip |
Change plugins directory through the configuration.yml file (#24007).
Patch by Helder Manuel Torres Vieira.
git-svn-id: http://svn.redmine.org/redmine/trunk@15963 e93f8b46-1217-0410-a6f0-8f06a7374b81
5 files changed, 26 insertions, 4 deletions
diff --git a/config/configuration.yml.example b/config/configuration.yml.example index 3522ef695..83232f30b 100644 --- a/config/configuration.yml.example +++ b/config/configuration.yml.example @@ -75,6 +75,15 @@ default: # attachments_storage_path: D:/redmine/files attachments_storage_path: + # Absolute path to the directory where plugins are stored. + # The default is the 'plugins' directory in your Redmine instance. + # Your Redmine instance needs to have read permission on this + # directory. + # Examples: + # plugins_path: /var/redmine/plugins + # plugins_path: D:/redmine/plugins + plugins_path: + # Configuration of the autologin cookie. # autologin_cookie_name: the name of the cookie (default: autologin) # autologin_cookie_path: the cookie path (default: /) diff --git a/lib/generators/redmine_plugin/redmine_plugin_generator.rb b/lib/generators/redmine_plugin/redmine_plugin_generator.rb index 562366342..a9d701577 100644 --- a/lib/generators/redmine_plugin/redmine_plugin_generator.rb +++ b/lib/generators/redmine_plugin/redmine_plugin_generator.rb @@ -7,7 +7,12 @@ class RedminePluginGenerator < Rails::Generators::NamedBase super @plugin_name = file_name.underscore @plugin_pretty_name = plugin_name.titleize - @plugin_path = "plugins/#{plugin_name}" + if Redmine::Configuration['plugins_path'].nil? + @plugin_path = File.join(Rails.root, 'plugins', plugin_name) + else + @plugin_path = File.join(Redmine::Configuration['plugins_path'], plugin_name) + end + puts @plugin_path end def copy_templates diff --git a/lib/generators/redmine_plugin_controller/redmine_plugin_controller_generator.rb b/lib/generators/redmine_plugin_controller/redmine_plugin_controller_generator.rb index 8351ce681..231b68810 100644 --- a/lib/generators/redmine_plugin_controller/redmine_plugin_controller_generator.rb +++ b/lib/generators/redmine_plugin_controller/redmine_plugin_controller_generator.rb @@ -9,7 +9,11 @@ class RedminePluginControllerGenerator < Rails::Generators::NamedBase super @plugin_name = file_name.underscore @plugin_pretty_name = plugin_name.titleize - @plugin_path = "plugins/#{plugin_name}" + if Redmine::Configuration['plugins_path'].nil? + @plugin_path = File.join(Rails.root, 'plugins', plugin_name) + else + @plugin_path = File.join(Redmine::Configuration['plugins_path'], plugin_name) + end @controller_class = controller.camelize end diff --git a/lib/generators/redmine_plugin_model/redmine_plugin_model_generator.rb b/lib/generators/redmine_plugin_model/redmine_plugin_model_generator.rb index 2e5f03108..bea9b6808 100644 --- a/lib/generators/redmine_plugin_model/redmine_plugin_model_generator.rb +++ b/lib/generators/redmine_plugin_model/redmine_plugin_model_generator.rb @@ -14,7 +14,11 @@ class RedminePluginModelGenerator < Rails::Generators::NamedBase super @plugin_name = file_name.underscore @plugin_pretty_name = plugin_name.titleize - @plugin_path = "plugins/#{plugin_name}" + if Redmine::Configuration['plugins_path'].nil? + @plugin_path = File.join(Rails.root, 'plugins', plugin_name) + else + @plugin_path = File.join(Redmine::Configuration['plugins_path'], plugin_name) + end @model_class = model.camelize @table_name = @model_class.tableize @migration_filename = "create_#{@table_name}" diff --git a/lib/redmine/plugin.rb b/lib/redmine/plugin.rb index 503c3db2c..9ab364b3a 100644 --- a/lib/redmine/plugin.rb +++ b/lib/redmine/plugin.rb @@ -44,7 +44,7 @@ module Redmine #:nodoc: # When rendered, the plugin settings value is available as the local variable +settings+ class Plugin cattr_accessor :directory - self.directory = File.join(Rails.root, 'plugins') + self.directory = Redmine::Configuration['plugins_path'] || File.join(Rails.root, 'plugins') cattr_accessor :public_directory self.public_directory = File.join(Rails.root, 'public', 'plugin_assets') |