diff --git a/railties/lib/tasks/clear.rake b/railties/lib/tasks/clear.rake deleted file mode 100644 index 25769f3088..0000000000 --- a/railties/lib/tasks/clear.rake +++ /dev/null @@ -1,29 +0,0 @@ -namespace :clear do - desc "Truncates all *.log files in log/ to zero bytes" - task :logs do - FileList["log/*.log"].each do |log_file| - f = File.open(log_file, "w") - f.close - end - end - - desc "Clear session, cache, and socket files from tmp/" - task :tmp => [ "clear:tmp:sesions", "clear:tmp:cache", "clear:tmp:sockets"] - - namespace :tmp do - desc "Clears all files in tmp/sessions" - task :sessions do - FileUtils.rm(Dir['tmp/sessions/[^.]*']) - end - - desc "Clears all files and directories in tmp/cache" - task :cache do - FileUtils.rm_rf(Dir['tmp/cache/[^.]*']) - end - - desc "Clears all ruby_sess.* files in tmp/sessions" - task :sockets do - FileUtils.rm(Dir['tmp/sockets/[^.]*']) - end - end -end \ No newline at end of file diff --git a/railties/lib/tasks/logs.rake b/railties/lib/tasks/logs.rake new file mode 100644 index 0000000000..32cbaeb358 --- /dev/null +++ b/railties/lib/tasks/logs.rake @@ -0,0 +1,9 @@ +namespace :logs do + desc "Truncates all *.log files in log/ to zero bytes" + task :clear do + FileList["log/*.log"].each do |log_file| + f = File.open(log_file, "w") + f.close + end + end +end diff --git a/railties/lib/tasks/pre_namespace_aliases.rake b/railties/lib/tasks/pre_namespace_aliases.rake index 24005e7772..b44464b693 100644 --- a/railties/lib/tasks/pre_namespace_aliases.rake +++ b/railties/lib/tasks/pre_namespace_aliases.rake @@ -1,5 +1,5 @@ # clear -task :clear_logs => "clear:logs" +task :clear_logs => "logs:clear" # test task :recent => "test:recent" diff --git a/railties/lib/tasks/tmp.rake b/railties/lib/tasks/tmp.rake new file mode 100644 index 0000000000..dcb22f789b --- /dev/null +++ b/railties/lib/tasks/tmp.rake @@ -0,0 +1,27 @@ +namespace :tmp do + desc "Clear session, cache, and socket files from tmp/" + task :clear => [ "tmp:sesions:clear", "tmp:cache:clear", "tmp:sockets:clear"] + + desc "Creates tmp directories for sessions, cache, and sockets" + task :create do + FileUtils.mkdir "tmp" + FileUtils.mkdir "tmp/sessions" + FileUtils.mkdir "tmp/cache" + FileUtils.mkdir "tmp/sockets" + end + + desc "Clears all files in tmp/sessions" + task :clear_sessions do + FileUtils.rm(Dir['tmp/sessions/[^.]*']) + end + + desc "Clears all files and directories in tmp/cache" + task :clear_cache do + FileUtils.rm_rf(Dir['tmp/cache/[^.]*']) + end + + desc "Clears all ruby_sess.* files in tmp/sessions" + task :clear_sockets do + FileUtils.rm(Dir['tmp/sockets/[^.]*']) + end +end \ No newline at end of file