From 5d1d9d9ddc5c957f057ed866e091ef91ec2129fa Mon Sep 17 00:00:00 2001 From: John Trupiano Date: Sat, 7 Jun 2008 15:20:12 -0400 Subject: [PATCH] Added a :normalize_asset_timestamps property. This is queried in finalize_update to determine whether or not to touch all of the assets. Subversion has a configuration option (use-commit-timestamps), which renders this process unnecessary if set. --- CHANGELOG | 5 +++++ lib/capistrano/recipes/deploy.rb | 12 ++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index e002f633..a55350d2 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,8 @@ +*unreleased* + +* Added :normalize_asset_timestamps option to deployment, defaulting to true, which allows asset timestamping to be disabled [John Trupiano] + + *2.4.0 Preview Release #1* (2.3.101) June 5, 2008 * Only make deploy:start, deploy:stop, and deploy:restart try sudo as :runner. The other sudo-enabled tasks (deploy:setup, deploy:cleanup, etc.) will now use the :admin_runner user (which by default is unset). [Jamis Buck] diff --git a/lib/capistrano/recipes/deploy.rb b/lib/capistrano/recipes/deploy.rb index 1e33c65a..7e613711 100644 --- a/lib/capistrano/recipes/deploy.rb +++ b/lib/capistrano/recipes/deploy.rb @@ -208,7 +208,9 @@ namespace :deploy do symlinks to the shared directory for the log, system, and tmp/pids \ directories, and will lastly touch all assets in public/images, \ public/stylesheets, and public/javascripts so that the times are \ - consistent (so that asset timestamping works). + consistent (so that asset timestamping works). This touch process \ + is only carried out if the :normalize_asset_timestamps variable is \ + set to true, which is the default. DESC task :finalize_update, :except => { :no_release => true } do run "chmod -R g+w #{latest_release}" if fetch(:group_writable, true) @@ -224,9 +226,11 @@ namespace :deploy do ln -s #{shared_path}/pids #{latest_release}/tmp/pids CMD - stamp = Time.now.utc.strftime("%Y%m%d%H%M.%S") - asset_paths = %w(images stylesheets javascripts).map { |p| "#{latest_release}/public/#{p}" }.join(" ") - run "find #{asset_paths} -exec touch -t #{stamp} {} ';'; true", :env => { "TZ" => "UTC" } + if fetch(:normalize_asset_timestamps, true) + stamp = Time.now.utc.strftime("%Y%m%d%H%M.%S") + asset_paths = %w(images stylesheets javascripts).map { |p| "#{latest_release}/public/#{p}" }.join(" ") + run "find #{asset_paths} -exec touch -t #{stamp} {} ';'; true", :env => { "TZ" => "UTC" } + end end desc <<-DESC