Change path in Rake file task prerequisites

93 Views Asked by At

I have a hardcoded file task

file 'feed.json' => 'lib/feed.rb'

How can I use match patterns

file '*.json' => 'lib/$1.rb' # Like this (this is pseudocode)
1

There are 1 best solutions below

0
Giuseppe Schembri On BEST ANSWER

Could this do the trick?

source_files = Rake::FileList.new("lib/*.md")
task :default => :json
task :json => source_files.ext(".rb")

rule ".json" => ".rb" do |t|
  # here what you need to be done
end

To Wacht this video could help.