I have a rake rule transforming files that also needs to depend on the :environment (meta-)task. However, I keep running into errors. The rule looks as follows:
task :parse => SOURCE_FILES.ext(".md")
rule ".md" => ->(f){ source_for_md(f) } do |t|
`do stuff ${t.source}`
end
I have tried rule ".md" => [:environment, ->(f){ source_for_md(f)] }
which results in the error:
Don't know how to handle rule dependent: :environment
I have also tried to define the depency upstream in the :parse task:
task parse: [:environment, SOURCE_FILES.ext(".md")]
... with no luck.
A workaround that is only slightly inelegant: moving the dependency a further level up in the chain works:
task do_parse: [:environment, :parse]
task :parse => SOURCE_FILES.ext(".md")
rule ".md" => ->(f){ source_for_md(f) } do |t|
`do stuff ${t.source}`
end