ruby / ruby/rake

Request: An alternate FileTask that checks whether the file was made

Aperta
#342 0 commenti 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

I think the current implementation of the file task makes perfect sense: just trigger a series of actions based on a file's status, in case you don't necessarily want to actually produce that file.

However, in cases where you do want to produce that file, it would be nice to have a separate task type that supports that, i.e. fails if the task actions don't produce the file even when there are no exceptions thrown.

Example:

class Rake::RequiredFileTask < Rake::FileTask                  
  def execute(*args)                                          
    super(*args)                                              
    File.exists?(name) or raise "File #{name} was not created successfully"
  end                                                                      
end                                                                        

module Rake::DSL
  def required_file(*args, &block) # :doc:
    Rake::RequiredFileTask.define_task(*args, &block)
  end                                                
end

Then, if invoked as:

required_file 'a.out' do |t|
  # do nothing
end

an error would be thrown:

rake aborted!
File a.out was not created successfully

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 leggendo il comportamento esistente di Rake::FileTask e le Rake::DSL task definitions citate nell’issue. Verifica come viene eseguita una task action quando non si verificano eccezioni, quindi conferma che il nuovo task type deve fallire quando il file di cui porta il nome è ancora assente, usando il required_file example fornito come controllo del completamento.

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

Valutazione

Stack tecnologico
ruby
Ambito
build-system
Tipo di issue
Funzionalità
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.