Project

General

Profile

Patch #24007 ยป config_plugins_path.diff

Helder Manuel Torres Vieira, 2016-10-05 20:17

View differences:

config/configuration.yml.example
75 75
  # attachments_storage_path: D:/redmine/files
76 76
  attachments_storage_path:
77 77

  
78
  # Absolute path to the directory where plugins are stored.
79
  # The default is the 'plugins' directory in your Redmine instance.
80
  # Your Redmine instance needs to have write permission on this
81
  # directory.
82
  # Examples:
83
  # plugins_path: /var/redmine/plugins
84
  # plugins_path: D:/redmine/plugins
85
  plugins_path:
86

  
78 87
  # Configuration of the autologin cookie.
79 88
  # autologin_cookie_name: the name of the cookie (default: autologin)
80 89
  # autologin_cookie_path: the cookie path (default: /)
lib/generators/redmine_plugin/redmine_plugin_generator.rb
7 7
    super
8 8
    @plugin_name = file_name.underscore
9 9
    @plugin_pretty_name = plugin_name.titleize
10
    @plugin_path = "plugins/#{plugin_name}"
10
    if Redmine::Configuration['plugins_path'].nil?
11
      @plugin_path = File.join(Rails.root, 'plugins', plugin_name)
12
    else
13
      @plugin_path = File.join(Redmine::Configuration['plugins_path'], plugin_name)
14
    end
15
    puts @plugin_path
11 16
  end
12 17

  
13 18
  def copy_templates
lib/generators/redmine_plugin_controller/redmine_plugin_controller_generator.rb
9 9
    super
10 10
    @plugin_name = file_name.underscore
11 11
    @plugin_pretty_name = plugin_name.titleize
12
    @plugin_path = "plugins/#{plugin_name}"
12
    if Redmine::Configuration['plugins_path'].nil?
13
      @plugin_path = File.join(Rails.root, 'plugins', plugin_name)
14
    else
15
      @plugin_path = File.join(Redmine::Configuration['plugins_path'], plugin_name)
16
    end
13 17
    @controller_class = controller.camelize
14 18
  end
15 19

  
lib/generators/redmine_plugin_model/redmine_plugin_model_generator.rb
14 14
    super
15 15
    @plugin_name = file_name.underscore
16 16
    @plugin_pretty_name = plugin_name.titleize
17
    @plugin_path = "plugins/#{plugin_name}"
17
    if Redmine::Configuration['plugins_path'].nil?
18
      @plugin_path = File.join(Rails.root, 'plugins', plugin_name)
19
    else
20
      @plugin_path = File.join(Redmine::Configuration['plugins_path'], plugin_name)
21
    end
18 22
    @model_class = model.camelize
19 23
    @table_name = @model_class.tableize
20 24
    @migration_filename = "create_#{@table_name}"
lib/redmine/plugin.rb
44 44
  # When rendered, the plugin settings value is available as the local variable +settings+
45 45
  class Plugin
46 46
    cattr_accessor :directory
47
    self.directory = File.join(Rails.root, 'plugins')
47
    self.directory = Redmine::Configuration['plugins_path'] || File.join(Rails.root, 'plugins')
48 48

  
49 49
    cattr_accessor :public_directory
50 50
    self.public_directory = File.join(Rails.root, 'public', 'plugin_assets')
    (1-1/1)