From 8e9cfdfcda0da1b02e917983658d00250650f264 Mon Sep 17 00:00:00 2001
From: Sam <sam.saffron@gmail.com>
Date: Fri, 7 Feb 2014 11:36:44 +1100
Subject: [PATCH] BUGFIX: plugins not updating after assets:precompile

Now that we have a fancy cache we can nuke all old assets
This is way better cause it ensures all .erbs get re-evaluated
And ensures plugins are updated
---
 lib/tasks/assets.rake | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lib/tasks/assets.rake b/lib/tasks/assets.rake
index a71236ff9e7..64548cc4d49 100644
--- a/lib/tasks/assets.rake
+++ b/lib/tasks/assets.rake
@@ -5,6 +5,12 @@ task 'assets:precompile:before' do
     raise "rake assets:precompile should only be run in RAILS_ENV=production, you are risking unminified assets"
   end
 
+  # Ensure we ALWAYS do a clean build
+  # We use many .erbs that get out of date quickly, especially with plugins
+  puts "Purging old assets"
+  `rm -fr #{Rails.root}/tmp/cache`
+  `rm -fr #{Rails.root}/public/assets`
+
   # in the past we applied a patch that removed asset postfixes, but it is terrible practice
   # leaving very complicated build issues
   # https://github.com/rails/sprockets-rails/issues/49