Method needed to get rake command line options for spawning new rake job

Offen
#263 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
45/100
Issue-Typ
Feature
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Tech-Stack
ruby
Bereich
cli

Rechercherichtung

Beginne mit Rake.application und verfolge die Einstiegspunkte handle_options und standard_rake_options, um zu sehen, wie Befehlszeilenoptionen geparst und beibehalten werden. Prüfe, wie ein Rakefile der obersten Ebene den geparsten Wert lesen könnte, wenn es Jobs in Unterverzeichnissen startet. Als erledigt gilt die Aufgabe, wenn die geparsten Optionen über ein öffentliches application-Attribut verfügbar gemacht werden, ohne dass Aufrufer die Optionsanalyse duplizieren müssen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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.

Vorherrschende Sprache
Ruby
Sterne
2.5k
Forks
650
Ø Merge
6 Min.
Gemergte PRs (30 T.)
3

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus ruby/rake

Alle Issues in ruby/rake

Ähnliche Issues

Weitere Issues zu Ruby

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.