-
Notifications
You must be signed in to change notification settings - Fork 985
/
assets_paths.rb
23 lines (22 loc) · 1.27 KB
/
assets_paths.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Gems like bootstrap-sass and patternfly-sass started adding their assets by
# using initializers. Since our plugins register only after: finisher_hook, that
# delays the assets initializers and they run after Sprockets::Context is
# instantiated. As a result sprockets doesn't recognize these assets. A fix for
# this is to to make our plugins to register before: finisher_hook.
#
# See https://github.com/theforeman/foreman/pull/2943#issuecomment-168039237 for
# more details
plugins = Rails.application.railties.select { |e| e.railtie_name.match /foreman/ }
plugins.map(&:initializers).flatten.each do |initializer|
options = initializer.instance_variable_get('@options')
if options.key(:finisher_hook).present? && options.key(:finisher_hook) == :after
deprecation_message = "\nInitializing plugins using :after => :finish_hook in \
your engine is deprecated. It delays the load of some assets in Sprockets. \
If you are the plugin author, please change your plugin engine initializer to use \
:before => :finisher_hook or after_initialize. Affected initializer name is \
#{initializer.name}."
Foreman::Deprecation.deprecation_warning('1.13', deprecation_message)
options[:before] = options.delete :after
initializer.instance_variable_set('@options', options)
end
end