ruby - How to make rake task dependent on file and another task -
i have 2 rake tasks need dependent on file, rake task. here i've tried:
task :dependencies # install pacman packages if necessary end # :build task should dependent on output.pdf , dependencies task task :build => [:dependencies, 'output.pdf'] # file task should dependent on dependencies (in case it's run directly) file 'output.pdf' => [:dependencies, 'output.md']
how can tell file task depend on rake task as as input file? also, how can tell regular task dependent on file task , regular task?
what you've got works me. can't diagnose further without output.
rakefile:
task :dependencies puts "installing dependencies" end task build: ['dependencies', 'output.pdf'] file 'output.pdf' => ['dependencies', 'output.md'] file.write 'output.pdf', '' end
running build:
$ ls rakefile output.md $ rake -t build ** invoke build (first_time) ** invoke dependencies (first_time) ** execute dependencies installing dependencies ** invoke output.pdf (first_time) ** invoke dependencies ** invoke output.md (first_time, not_needed) ** execute output.pdf ** execute build $ ls rakefile output.md output.pdf
running output.pdf:
$ rm output.pdf $ rake -t output.pdf ** invoke output.pdf (first_time) ** invoke dependencies (first_time) ** execute dependencies installing dependencies ** invoke output.md (first_time, not_needed) ** execute output.pdf $ ls rakefile output.md output.pdf
ps: rake doesn't care symbols vs strings in task or dependency names.
Comments
Post a Comment