aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/tasks/clear.rake
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2006-02-27 04:38:39 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2006-02-27 04:38:39 +0000
commit985cb441103c79651f12a013326aa15f54fa8182 (patch)
tree4aa28f1488ba5cdf66e58ed6df0aa448dfdbba0b /railties/lib/tasks/clear.rake
parent1a06d324df43bfb3287293934f0ef34a7c790a34 (diff)
downloadrails-985cb441103c79651f12a013326aa15f54fa8182.tar.gz
rails-985cb441103c79651f12a013326aa15f54fa8182.tar.bz2
rails-985cb441103c79651f12a013326aa15f54fa8182.zip
Added namespaces to all tasks, so for example load_fixtures is now db:fixtures:load. All the old task names are still valid, they just point to the new namespaced names. "rake -T" will only show the namespaced ones, though [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3680 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties/lib/tasks/clear.rake')
-rw-r--r--railties/lib/tasks/clear.rake29
1 files changed, 29 insertions, 0 deletions
diff --git a/railties/lib/tasks/clear.rake b/railties/lib/tasks/clear.rake
new file mode 100644
index 0000000000..25769f3088
--- /dev/null
+++ b/railties/lib/tasks/clear.rake
@@ -0,0 +1,29 @@
+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