Fix issue causing all assets to be precompiled

Matchers specified in config.assets.precompile (also referred to as
'filters' in the Sprockets internals) are called on each asset in the
assets load path and should return a boolean expression.
The String used in ThemeFinder is truthy. Because matchers are
[OR'd][1], this was causing all assets to precompiled.

 * Use a lambda rather than Proc to ensure arity is checked.

[1]:https://github.com/sstephenson/sprockets/blob/2.x/lib/sprockets/base.rb#L421

Signed-off-by: Alex Coles <alex@alexbcoles.com>
pull/1032/head
Alex Coles 11 years ago
parent 3d7ec71e75
commit 265c30a4a6
  1. 6
      lib/open_project/themes/theme_finder.rb

@ -66,8 +66,10 @@ module OpenProject
# we need to wrap the call to #stylesheet_manifest in a Proc,
# because when this code is executed the theme instance (theme) hasn't had
# a chance to override the method yet
Rails.application.config.assets.precompile << Proc.new {
theme.stylesheet_manifest unless theme.abstract?
Rails.application.config.assets.precompile << -> (path) {
return if theme.abstract?
theme.stylesheet_manifest == path
}
end

Loading…
Cancel
Save