Note that there are some explanatory texts on larger screens.

plurals
  1. PORake Default Task and Namespaces
    primarykey
    data
    text
    <p>I have read through the docs and looked at quite a few examples but I am not clear on defaults and namespaces. (using rake, version 10.0.3)</p> <p>First it seems, though I do not recall seeing this explicitly, that there can be only ONE default task regardless of how many are defined. Apparently the load order (PROJECT_NAME::Application.load_tasks) determines the winner. When I have struggled to create a namespaced default I have found that I have sometimes overridden the normal default for a rails app where:</p> <pre><code>rake </code></pre> <p>defaults to running the tests.</p> <p>First here is the "rake -T" command:</p> <pre><code>$ rake -T a_name rake a_name:a_task_1 # a_task_1 rake a_name:a_task_2 # a_task_2 rake a_name:b_name:b_task_1 # b_task_1 rake a_name:b_name:b_task_2 # b_task_2 rake a_name:default # This is hopefully a namespaced default </code></pre> <p>When I run the namespace only which I am hoping is the "default" I get:</p> <pre><code>$ rake a_name rake aborted! Don't know how to build task 'a_name' (See full trace by running task with --trace) </code></pre> <p>I was expecting this to run the b_task_1 in the b_name namespace because I have declared it as the default</p> <p>However, If I explicitly tack on the word "default" I get this:</p> <pre><code>$ rake a_name:default a_task_1 </code></pre> <p>Anyway I am thoroughly confused. Can anyone help clarify this for me...</p> <pre><code>namespace :a_name do desc "a_task_1" task :a_task_1 do puts "a_task_1" end desc "a_task_2" task :a_task_2 do puts "a_task_2" end namespace :b_name do desc "b_task_1" task :b_task_1 do puts "b_task_1" end desc "b_task_2" task :b_task_2 do puts "b_task_2" end end desc "This is hopefully a namespaced default" task :default =&gt; 'b_name:b_task_1' end </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload