title: Rake multitask with a variable task list
body: <p>I've read some <a href="https://stackoverflow.com/questions/825748/how-do-i-pass-command-line-arguments-to-a-rake-task" title="Posts">posts</a>, <a href="http://ozmm.org/posts/rake_start.html" rel="nofollow noreferrer" title="tips">tips</a> and <a href="http://www.dreamincode.net/forums/topic/149671-rake/" rel="nofollow noreferrer" title="Tutorials">tutorials</a>  about using rake arguments and rake multitask. The following would be some simple examples.</p>
  
  <pre><code>multitask 'build_parallel' =&gt; ['build_a', 'build_z']
  </code></pre>
  
  <p>or</p>
  
  <pre><code>multitask :mytask =&gt; [:task1, :task2, :task3] do
    puts "Completed parallel execution of tasks 1 through 3."
  end
  </code></pre>
  
  <p>My question:</p>
  
  <p>What is the best way to build a global variable in one task that I can then use in my multitask? The following doesn't execute task1, task2, task3...which means the global $build_list is empty</p>
  
  <pre><code>$build_list = []
  task :build do
     $build_list &lt;&lt; 'task1' 
     $build_list &lt;&lt; 'task2' 
     $build_list &lt;&lt; 'task3'
     Rake::MultiTask[:build_parallel].invoke # or Rake::Task[:build_parallel].invoke
  end
  
  multitask :build_parallel =&gt; $build_list
  </code></pre>
  
  <p>Should I be using an ENV variable here or is some other method preferred?</p>