tags:

views:

579

answers:

1

Given something like:

namespace :my_tasks do
  task :foo do
    do_something
  end

  task :bar do
    do_something_else
  end

  task :all => [:foo, :bar]
end

How do I make :all be the default task, so that running rake my_tasks will call it (instead of having to call rake my_tasks:all)?

+8  A: 

Place it outside the namespace like this:

namespace :my_tasks do
  task :foo do
    do_something
  end

  task :bar do
    do_something_else
  end

end

task :all => ["my_tasks:foo", "my_tasks:bar"]
Simon
That only makes it available to be called as `rake all`. In this case, I have other namespaces, so what I want is to be able to call the task `my_tasks:all` as `rake my_tasks`, not as `rake all`.
obvio171
so then just use:task :my_tasks => ["my_tasks:foo", "my_tasks:bar"]
Simon
Up voted for simon's comment, I had forgotten that this is how I do it.
James Deville