Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Speed up touching, make shell escaping more robust.

  • Loading branch information...
commit ae11631c5a7a5080743500052cba8cfd0b69c388 1 parent 35cc93f
@oggy oggy authored
Showing with 6 additions and 7 deletions.
  1. +6 −7 lib/turbo-sprockets/tasks/assets.rake
View
13 lib/turbo-sprockets/tasks/assets.rake
@@ -1,4 +1,5 @@
require "fileutils"
+require 'shellwords'
# Clear all assets tasks from sprockets railtie,
# but preserve any extra actions added via 'enhance'
@@ -74,13 +75,11 @@ namespace :assets do
# This time reflects the last time the assets were being used.
if digest.nil?
::Rails.logger.debug "Updating mtimes for current assets..."
- known_assets.each do |asset|
- full_path = File.join(target, asset)
- if File.exist?(full_path)
- # File.utime raises 'Operation not permitted' unless user is owner of file.
- # Non-owners have permission to update mtime to the current time using 'touch'.
- `touch "#{full_path}"`
- end
+ paths = known_assets.map { |asset| File.join(target, asset) }
+ paths.each_slice(1000) do |slice|
+ # File.utime raises 'Operation not permitted' unless user is owner of file.
+ # Non-owners have permission to update mtime to the current time using 'touch'.
+ `touch -c #{slice.shelljoin}`
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.