Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed up touching, make shell escaping more robust. #48

Merged
merged 1 commit into from
Jan 6, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions lib/turbo-sprockets/tasks/assets.rake
Original file line number Original file line Diff line number Diff line change
@@ -1,4 +1,5 @@
require "fileutils" require "fileutils"
require 'shellwords'


# Clear all assets tasks from sprockets railtie, # Clear all assets tasks from sprockets railtie,
# but preserve any extra actions added via 'enhance' # but preserve any extra actions added via 'enhance'
Expand Down Expand Up @@ -74,13 +75,11 @@ namespace :assets do
# This time reflects the last time the assets were being used. # This time reflects the last time the assets were being used.
if digest.nil? if digest.nil?
::Rails.logger.debug "Updating mtimes for current assets..." ::Rails.logger.debug "Updating mtimes for current assets..."
known_assets.each do |asset| paths = known_assets.map { |asset| File.join(target, asset) }
full_path = File.join(target, asset) paths.each_slice(1000) do |slice|
if File.exist?(full_path) # File.utime raises 'Operation not permitted' unless user is owner of file.
# 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'.
# Non-owners have permission to update mtime to the current time using 'touch'. `touch -c #{slice.shelljoin}`
`touch "#{full_path}"`
end
end end
end end


Expand Down