diff options
author | Go MAEDA <maeda@farend.jp> | 2019-05-27 08:53:49 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2019-05-27 08:53:49 +0000 |
commit | 069577c1331ccda51966aa9873e12ebcf758a4b7 (patch) | |
tree | 2659f848d4010eade63d5385b2032e95f20d1dfb /config/initializers | |
parent | 5f41a4320b2b8e3d9b73e99d701bf6bb84b614f6 (diff) | |
download | redmine-069577c1331ccda51966aa9873e12ebcf758a4b7.tar.gz redmine-069577c1331ccda51966aa9873e12ebcf758a4b7.zip |
Add support for reloading plugin assets automatically in development mode (#31457).
Patch by Kouhei Sutou.
git-svn-id: http://svn.redmine.org/redmine/trunk@18202 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'config/initializers')
-rw-r--r-- | config/initializers/30-redmine.rb | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/config/initializers/30-redmine.rb b/config/initializers/30-redmine.rb index 2b96ebdde..7536de487 100644 --- a/config/initializers/30-redmine.rb +++ b/config/initializers/30-redmine.rb @@ -20,12 +20,23 @@ if Object.const_defined?(:OpenIdAuthentication) end Redmine::Plugin.load -unless Redmine::Configuration['mirror_plugins_assets_on_startup'] == false + +plugin_assets_dirs = {} +Redmine::Plugin.all.each do |plugin| + plugin_assets_dirs[plugin.assets_directory] = ["*"] +end +plugin_assets_reloader = ActiveSupport::FileUpdateChecker.new([], plugin_assets_dirs) do Redmine::Plugin.mirror_assets end +Rails.application.reloaders << plugin_assets_reloader +unless Redmine::Configuration['mirror_plugins_assets_on_startup'] == false + plugin_assets_reloader.execute +end Rails.application.config.to_prepare do Redmine::FieldFormat::RecordList.subclasses.each do |klass| klass.instance.reset_target_class end + + plugin_assets_reloader.execute_if_updated end |