Method needed to get rake command line options for spawning new rake job
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 2.5k
- Forks
- 650
- Avg merge
- 6m
- Merged PRs (30d)
- 3
Description
I am implementing a "top level" Rakefile that will spawn off rake jobs in sub-directories.
This is not hard to do, except that I want to pass the same options to the jobs that was passed to the original rake command. I cannot find a way to reliably find out what those options were without using some quasi private methods such as handle_options in the application object. I do not want the targets, just the options.
Could we add code to handle_options to put the options that are parsed into an array that is a public attribute of the application object?
Then I could grab the rake options by a simple use of something like:
Rake.application.rake_options
If there is some way to easily do this that I am missing please let me know. I originally was just iterating over the ARGV entries and grabbing things out of it, but quickly realized that the command line options may or may not have an argument following a "-" prefixed option and there is no way I can know that without duplicating all the code in standard_rake_options.
Thanks.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with Rake.application and trace the handle_options and standard_rake_options entry points to see how command-line options are parsed and retained. Check how a top-level Rakefile could read the parsed value when spawning jobs in subdirectories. Done means the parsed options are exposed through a public application attribute without requiring callers to duplicate option parsing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100