Permalink
Browse files

Removed asset cleaning code, since it's not relevant

  • Loading branch information...
1 parent 965b9a6 commit 039e6fa036ac49c53d9c4217263ea18b5c3dd4f8 @ndbroadbent committed Sep 28, 2012
Showing with 3 additions and 56 deletions.
  1. +3 −9 README.md
  2. +0 −41 lib/sprockets/static_cleaner.rb
  3. +0 −1 lib/turbo-sprockets/railtie.rb
  4. +0 −5 lib/turbo-sprockets/tasks/assets.rake
View
@@ -33,24 +33,18 @@ Go on, run `rake assets:precompile` again, and it should be a whole lot faster t
Enjoy your lightning fast deploys!
-<!--#### Automatic clean up of old assets
+## Deployments
-By default, the `assets:precompile` task now deletes out-of-date assets after a new version is compiled. If you don't want to automatically delete old assets, you can turn off this behaviour by setting `config.assets.clean_after_precompile = false` in `config/environments/production.rb`.
--->
+### Capistrano
-## Deployments
+`turbo-sprockets-rails3` should work out of the box with Capistrano.
### Heroku
You won't be able to do an 'incremental update' on heroku, since your `public/assets`
folder will be empty at the start of each push. However, this gem can still cut your
precompile time in half, since it only compiles assets once to generate both digest and non-digest assets.
-<!--### Capistrano
-
-If you are deploying with Capistrano, it's not a good idea to symlink `public/assets` to a shared assets folder, because the asset cleanup task would delete the current assets before the deploy has finished. Keeping a separate copy of `public/assets` for each release also means that you can safely roll back to a previous release.
-The best approach would be to add a deploy step that copies the `public/assets` folder from your previous release into the current release, before running `assets:precompile`.-->
-
## Debugging
If you would like to view debugging information in your terminal during the `assets:precompile` task, add the following lines to the bottom of `config/environments/production.rb`:
@@ -1,41 +0,0 @@
-require 'fileutils'
-
-module Sprockets
- class StaticCleaner
- attr_accessor :env, :target
-
- def initialize(env, target, digest_files)
- @env = env
- @target = File.join(target, '') # Make sure target ends with trailing /
- @digest_files = digest_files
- end
-
- # Remove all files from `config.assets.prefix` that are not found in manifest.yml
- def remove_old_assets!
- known_files = @digest_files.flatten
- known_files += known_files.map {|f| "#{f}.gz" } # Recognize gzipped files
- known_files << 'manifest.yml'
-
- assets_prefix = ::Rails.application.config.assets.prefix
-
- Dir[File.join(target, "**/*")].each do |path|
- unless File.directory?(path)
- logical_path = path.sub(target, '')
- unless logical_path.in? known_files
- FileUtils.rm path
- env.logger.debug "Deleted old asset at public#{assets_prefix}/#{logical_path}"
- end
- end
- end
-
- # Remove empty directories (reversed to delete top-level empty dirs first)
- Dir[File.join(target, "**/*")].reverse.each do |path|
- if File.exists?(path) && File.directory?(path) && (Dir.entries(path) - %w(. ..)).empty?
- FileUtils.rmdir path
- logical_path = path.sub(target, '')
- env.logger.debug "Deleted empty directory at public#{assets_prefix}/#{logical_path}"
- end
- end
- end
- end
-end
@@ -1,7 +1,6 @@
require "action_controller/railtie"
module Sprockets
- autoload :StaticCleaner, "sprockets/static_cleaner"
autoload :StaticNonDigestGenerator, "sprockets/static_non_digest_generator"
end
@@ -78,11 +78,6 @@ namespace :assets do
)
compiler.compile
end
-
- if config.assets.clean_after_precompile
- cleaner = Sprockets::StaticCleaner.new(env, target, config.assets.digest_files)
- cleaner.remove_old_assets!
- end
end
task :all => ["assets:cache:clean"] do

0 comments on commit 039e6fa

Please sign in to comment.