Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix clear cache regression. tmp/cache directory includes sass.

  • Loading branch information...
commit ad492ea338a3e21ff4d976e95cc390fffd449ab3 1 parent 1e69181
@kennyj authored
View
11 actionpack/lib/sprockets/assets.rake
@@ -86,7 +86,16 @@ namespace :assets do
namespace :cache do
task :clean => ["assets:environment"] do
- Rails.application.assets.cache.clear
+ cache = Rails.application.assets.cache
+ cache_path = cache.respond_to?(:cache_path) ? cache.cache_path : nil
+
+ # Sprockets cache clear
+ cache.clear
+
+ Rake::Task["tmp:cache:clear"].invoke
+
+ # If Sprockets cache is ActiveSupport::Cache::FileStore, Rails cache path includes the assets cache path.
+ FileUtils.mkdir_p(cache_path) if cache_path
end
end
View
2  railties/test/application/assets_test.rb
@@ -497,11 +497,13 @@ class ::PostsController < ActionController::Base; end
precompile!
quietly do
+ FileUtils.mkdir_p(File.join(app_path, "tmp", "cache", "foo"))
Dir.chdir(app_path){ `bundle exec rake assets:cache:clean` }
end
require "#{app_path}/config/environment"
assert_equal 0, Dir.entries(Rails.application.assets.cache.cache_path).size - 2 # reject [".", ".."]
+ assert_equal 1, Dir.entries(Rails.cache.cache_path).size - 2
end
private
Please sign in to comment.
Something went wrong with that request. Please try again.