1

Rake (like make) is able to have many targets/tasks specified on invocation. Is it possible for a rake task to access the list of tasks the user invoked, in order to do its job?

Scenario:

Consider a Rake-based build tool. A help task would like to know what tasks were also specified in order to print their usage and halt the build process. The benefit of this as opposed to rake-style parameter passing are cleaner syntax (rake help build instead of rake help task=build) and chaining (rake help build run_tests would print usage for both).

andrewdotnich
  • 16,195
  • 7
  • 38
  • 57

1 Answers1

2

Yes, it can, by accessing Rake.application.top_level_tasks and examining the collection that's returned.

andrewdotnich
  • 16,195
  • 7
  • 38
  • 57