title: How to run Rake tasks from within Rake tasks?
body: <p>I have a Rakefile that compiles the project in two ways, according to the global variable <code>$build_type</code>, which can be <code>:debug</code> or <code>:release</code> (the results go in separate directories):</p>
  
  <pre><code>task :build =&gt; [:some_other_tasks] do
  end
  </code></pre>
  
  <p>I wish to create a task that compiles the project with both configurations in turn, something like this:</p>
  
  <pre><code>task :build_all do
    [ :debug, :release ].each do |t|
      $build_type = t
      # call task :build with all the tasks it depends on (?)
    end
  end
  </code></pre>
  
  <p>Is there a way to call a task as if it were a method?  Or how can I achieve anything similar?</p>