summaryrefslogtreecommitdiffstats
path: root/lib/generators
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2016-11-18 12:14:41 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2016-11-18 12:14:41 +0000
commit7a9a22f3dd62ab4c1257db38f9b8c923bdcc4c8c (patch)
tree67e4713bd1bccbb0e81de2082d9da69046c6f523 /lib/generators
parent1f1e65cd4b92044638e132d8c0324b45b960f090 (diff)
downloadredmine-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
Diffstat (limited to 'lib/generators')
-rw-r--r--lib/generators/redmine_plugin/redmine_plugin_generator.rb7
-rw-r--r--lib/generators/redmine_plugin_controller/redmine_plugin_controller_generator.rb6
-rw-r--r--lib/generators/redmine_plugin_model/redmine_plugin_model_generator.rb6
3 files changed, 16 insertions, 3 deletions
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}"