Browse files

revise commandline guide [ci skip]

  • Loading branch information...
1 parent 955a72c commit b8aa3923af388dfbaf7524a83f3ee2f1f59cc36a @vijaydev vijaydev committed Sep 28, 2012
Showing with 6 additions and 12 deletions.
  1. +6 −12 guides/source/
18 guides/source/
@@ -480,15 +480,9 @@ The `tmp:` namespaced tasks will help you clear the `Rails.root/tmp` directory:
* `rake secret` will give you a pseudo-random key to use for your session secret.
* `rake time:zones:all` lists all the timezones Rails knows about.
-### Writing Rake Tasks
+### Custom Rake Tasks
-If you have (or want to write) any automation scripts outside your app (data import, checks, etc), you can make them as rake tasks. It's easy.
-INFO: [Complete guide about how to write tasks]( is available in the official documentation.
-Tasks should be placed in `Rails.root/lib/tasks` and should have a `.rake` extension.
-Each task should be defined in next format (dependencies are optional):
+Custom rake tasks have a `.rake` extension and are placed in `Rails.root/lib/tasks`.
desc "I am short, but comprehensive description for my cool task"
@@ -498,7 +492,7 @@ task :task_name => [:prerequisite_task, :another_task_we_depend_on] do
-If you need to pass parameters, you can use next format (both arguments and dependencies are optional):
+To pass arguments to your custom rake task:
task :task_name, [:arg_1] => [:pre_1, :pre_2] do |t, args|
@@ -509,20 +503,20 @@ end
You can group tasks by placing them in namespaces:
-namespace :do
+namespace :db
rafaelfranca Sep 28, 2012 Ruby on Rails member

I think is missing the do

rafaelfranca Sep 28, 2012 Ruby on Rails member

Fixed @ 9e34127

vijaydev Sep 29, 2012 Ruby on Rails member


desc "This task does nothing"
task :nothing do
# Seriously, nothing
-You can see your tasks to be listed by `rake -T` command. And, according to the examples above, you can invoke them as follows:
+Invocation of the tasks will look like:
rake task_name
rake "task_name[value 1]" # entire argument string should be quoted
-rake do:nothing
+rake db:nothing
NOTE: If your need to interact with your application models, perform database queries and so on, your task should depend on the `environment` task, which will load your application code.

0 comments on commit b8aa392

Please sign in to comment.