ruby / ruby/rake

rake -P output is ambiguous with prereq namespaces

Aperta
#704 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Lingua principale
Ruby
Stelle
2.5k
Fork
650
Merge medio
6m
PR unite (30g)
3

Descrizione

When tasks are in a namespace, their pre-reqs "inherit" the namespace prefix.

Given the following rakefile:

task :setup do
  puts "global setup, oops"
end

namespace :tool do
  task :setup do
    puts "setting up"
  end
  task run: :setup do
    puts "running"
  end
  task run2: 'tool:setup' do
    puts "running a second way"
  end
end

The both tasks run and run2 have the same pre-req (setup). However, task run omits the namespace, while run2 is explicit with its pre-req's namespace. Both forms work as expected:

$ rake tool:run
setting up
running

$ rake tool:run2
setting up
running a second way

However, when the pre-req tree is printed, rake is not clear about what the pre-reqs' full names are.

$ rake -P
rake setup
rake tool:run
    setup  # <--- This is ambiguous!
rake tool:run2
    tool:setup
rake tool:setup

The expectation is that rake -P prints the "fully resolved" pre-reqs and is thus clear about what task will actually be run. In the example above, it is not clear what tool:run's pre-req is. Is it the "global" setup, task as it appears in the -P output? Or is it in fact tool:setup because it is namespaced?

To be clear, rake's invocation behavior matches my expectations: tool:run invokes tool:setup, not setup. But this behavior is not evident in rake's --prereqs output.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia dal punto di ingresso dell’output di rake -P/--prereqs e riproduci il Rakefile mostrato nell’issue. Traccia come vengono risolti i prerequisiti con namespace per tool:run e tool:run2, quindi verifica che il prerequisito stampato per entrambi sia completamente qualificato e non ambiguo.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
ruby
Ambito
build-system, cli
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Tranquilla
Chiarezza
Specificata chiaramente
Idoneità per principianti
68/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.