add-support-for-auto-reloading-plugin-assets.diff

Kouhei Sutou, 2019-05-27 04:49

Download (996 Bytes)

View differences:

config/initializers/30-redmine.rb
20 20
end
21 21

  
22 22
Redmine::Plugin.load
23
unless Redmine::Configuration['mirror_plugins_assets_on_startup'] == false
23

  
24
plugin_assets_dirs = {}
25
Redmine::Plugin.all.each do |plugin|
26
  plugin_assets_dirs[plugin.assets_directory] = ["*"]
27
end
28
plugin_assets_reloader = ActiveSupport::FileUpdateChecker.new([], plugin_assets_dirs) do
24 29
  Redmine::Plugin.mirror_assets
25 30
end
31
Rails.application.reloaders << plugin_assets_reloader
32
unless Redmine::Configuration['mirror_plugins_assets_on_startup'] == false
33
  plugin_assets_reloader.execute
34
end
26 35

  
27 36
Rails.application.config.to_prepare do
28 37
  Redmine::FieldFormat::RecordList.subclasses.each do |klass|
29 38
    klass.instance.reset_target_class
30 39
  end
40

  
41
  plugin_assets_reloader.execute_if_updated
31 42
end