From 621e0792907686f7d4b82801d97ac8d84d0c9ee0 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Mon, 13 Aug 2012 13:27:39 -0400 Subject: speed up cache directory creation Let Rake control the cache directories. If the directory already exists, rake will skip creating it (vs the previous task which would always try to mkdir_p) --- railties/lib/rails/tasks/tmp.rake | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/railties/lib/rails/tasks/tmp.rake b/railties/lib/rails/tasks/tmp.rake index 0d6c10328f..093a05b6a4 100644 --- a/railties/lib/rails/tasks/tmp.rake +++ b/railties/lib/rails/tasks/tmp.rake @@ -2,10 +2,16 @@ namespace :tmp do desc "Clear session, cache, and socket files from tmp/ (narrow w/ tmp:sessions:clear, tmp:cache:clear, tmp:sockets:clear)" task :clear => [ "tmp:sessions:clear", "tmp:cache:clear", "tmp:sockets:clear"] + tmp_dirs = [ 'tmp/sessions', + 'tmp/cache', + 'tmp/sockets', + 'tmp/pids', + 'tmp/cache/assets' ] + + tmp_dirs.each { |d| dir d } + desc "Creates tmp directories for sessions, cache, sockets, and pids" - task :create do - FileUtils.mkdir_p(%w( tmp/sessions tmp/cache tmp/sockets tmp/pids tmp/cache/assets )) - end + task :create => tmp_dirs namespace :sessions do # desc "Clears all files in tmp/sessions" -- cgit v1.2.3