When defining rake tasks, it is possible to use namespaces, like this:
namespace :demolition do
task :fire_bazooka do
puts "kaboom!"
end
end
This could be called like rake demolition:fire_bazooka.
It is also possible to specify prerequisites for a task, like this:
# Single prerequisite
task :fire_bazooka => :load_bazooka do ....
# Multiple prerequisites
task :fire_bazooka => [:safety_check, :load_bazooka]
But how can I use a namespaced task as a prerequisite? This, obviously, does not work:
task :photograph_destruction => :demolition:fire_bazooka
You already found the solution (name as a string).
You may extend this answer. There is no need to define namespaces and tasks with symbols. You can use Strings.
Doing this, you have the advantage of same type for definition and usage of task names.
Your example looks like this: