Skip to content

Commit

Permalink
Added rake tasks for clearing cached assets; see README
Browse files Browse the repository at this point in the history
  • Loading branch information
mgomes committed May 28, 2010
1 parent 51b8753 commit 68babdb
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
6 changes: 6 additions & 0 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ Or you can specify individual files to cache, as such:

Files that are not included in the all.js or all.css bundle will still be served from their original directories.

== Clearing the cached assets

You can run the following rake task on Heroku to regenerate your cached assets:

rake asset_cache:clear

== Testing

To run the test suite:
Expand Down
6 changes: 3 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ require 'rake/rdoctask'
desc 'Default: run unit tests.'
task :default => :test

desc 'Test the heroku_asset_packager plugin.'
desc 'Test the heroku_asset_cacher plugin.'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.libs << 'test'
t.pattern = 'test/**/*_test.rb'
t.verbose = true
end

desc 'Generate documentation for the heroku_asset_packager plugin.'
desc 'Generate documentation for the heroku_asset_cacher plugin.'
Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'HerokuAssetPackager'
rdoc.title = 'HerokuAssetCacher'
rdoc.options << '--line-numbers' << '--inline-source'
rdoc.rdoc_files.include('README')
rdoc.rdoc_files.include('lib/**/*.rb')
Expand Down
16 changes: 12 additions & 4 deletions tasks/heroku_asset_cacher_tasks.rake
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
# desc "Explaining what the task does"
# task :heroku_asset_packager do
# # Task goes here
# end
namespace :asset_cache do
desc 'Clear the cached asset files (Run in production)'
task :clear do
asset_cache_path = File.join(File.dirname(__FILE__), "..", "..", "..", "..", "tmp", "asset_cache")
if File.directory?(asset_cache_path)
Dir.entries(asset_cache_path).each do |file|
next if file == "." || file == ".."
File.delete(File.join(asset_cache_path, file))
end
end
end
end

0 comments on commit 68babdb

Please sign in to comment.