Created
January 27, 2009 11:15
-
-
Save fauxparse/53300 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :themes do | |
desc "Clear out old cached versions of theme files" | |
task :uncache do | |
Dir[File.join(RAILS_ROOT, "themes/*")].each do |theme| | |
%w(images javascripts stylesheets).each do |dir| | |
if File.directory?(File.join(theme, dir)) | |
Dir[File.join(theme, dir, "*")].each do |file| | |
dest = File.join RAILS_ROOT, "public", dir, File.basename(file) | |
if File.exist?(dest) && File.mtime(dest) < File.mtime(file) | |
puts "X #{dest}" | |
File.unlink(dest) | |
else | |
puts "- #{dest}" | |
end | |
end | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment