capistrano-plugins / capistrano-faster-assets

Skips asset compilation if none of the assets were changed since last release.
MIT License
186 stars 38 forks source link

asset:precompile enhancements are not cleared #22

Closed silva96 closed 8 years ago

silva96 commented 8 years ago

Rake Task Enhance is the standard way to add prerequisites to a rake task, in one of our projects we use it to enhance the asset precompilation as in the following example:

Rake::Task['assets:precompile'].enhance ['assets:write_error_pages']

Rake::Task['assets:precompile'].enhance do
  Rake::Task['assets:delete_error_pages'].invoke
end

So when clearing actions in this line (Rake::Task["deploy:assets:precompile"].clear_actions) only the actions are cleared but not the prerequisites I believe, because the enhancements are being executed before the asset precompilation even when the clear_actions is present.

The problem is that if those enhancements create some dynamic assets, those are being created before the evaluation of the diffs in the assets folders among both releases, hence both diffs will differ

The problem in the code above is that we need to create dynamic error pages into the asset folder , then precompile them, then delete the files from the assets folder. If the diff is calculated after the files are created, the diff will find differences.