If you define a task like this:
namespace :test do
rule "" do |t|
# t.name is 'test::[whatever]"
end
end
Then the ""
task will act as a catchall and you can use its name as an argument for whatever you want
Pregunta
I am watching a Peepcode screencast Play by Play: Jim Weirich.
He executes a rake task that appears to pass the final task name as an option.
See how the task :demo creates a "demo" folder. How was this done?
EDIT:
Thanks, Alex.Bullard.
So with something like this:
namespace :project do
namespace :ruby do
rule "" do |t|
puts t.name
end
end
end
Running $ rake project:ruby:demo
outputs project:ruby:demo
.
Do I have to t.name.split(":")
or is there a way to grab just that final name?
Solución
If you define a task like this:
namespace :test do
rule "" do |t|
# t.name is 'test::[whatever]"
end
end
Then the ""
task will act as a catchall and you can use its name as an argument for whatever you want