seomoz / shovel

Rake, for Python
MIT License
660 stars 49 forks source link

How do I denote dependencies? #44

Open retorquere opened 6 years ago

retorquere commented 6 years ago

I'm looking to implement the equivalent of

file 'README.html' => 'README.md' do |task|
  system "pandoc -o #{task.name} #{task.source}"
end

file 'README.md' do |task|
  system "curl -O 'https://raw.githubusercontent.com/seomoz/shovel/master/README.md'"
end
dlecocq commented 6 years ago

shovel currently has mechanism for this. The nearest thing (which is a far cry from this functionality) is to invoke other tasks within the body of another task. However, this doesn't do any optimization for when dependencies are already satisfied - that would have to be implemented for each method.

@task
def makeREADMEhtml():
    makeREADMEmd()
    ...

@task
def makeREADMEmd()
    ...
retorquere commented 6 years ago

I've whipped up something that does dependencies, Makefile-style here. Interested in merging something like this?

FilBot3 commented 4 years ago

To me, its just calling functions. If you need a previous task run, you call it in your shovel/shovel.py and it should run. Then you can throw extra Python logic on it if needed. I find myself using the import os library a lot for file and command based tasks.