문제

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).

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top