From: Jim Weirich Date: 2006-03-21T03:45:40+09:00 Subject: Re: rake rules with multiple prerequisites Joel VanderWerf wrote: > Jim Weirich wrote: >>> >> Remember, your rule says that you can build a site_XXX file if the >> following file (or rules to build the following files) exist: >> site_cfg_file(fn), "foo", "bar" and "baz". I would check to see if >> "foo", "bar" and "baz" all exist. > > Here's what happens in this example: Oops. Sorry, I misread your example. I thought you were saying the first example with the [proc{"foo"} ... ] wasn't working. As I understand, what you would like is: FileList["foo", ... ] to work as well. The problem is that a plain string in the *rule* dependency list already has a meaning: it is the file extension to be used in the name of the source file for the target. > Furthermore, if I comment out the proc: > > # proc {|fn| "__#{fn}"}, > > (still using the FileList) then rake goes into a tailspin: > > $ rake site_stuff --trace > (in /home/vjoel/ruby/misc/rake) > rake aborted! > Rule Recursion Too Deep: [site_stuff => site_stuff => site_stuff => > site_stuff =....... The reason for the tail spin is that plain strings in the depedency list for rules specifies file extensions. Since "site_stuff" has no extension, it comes out unchanged in the dependency list. So it looks like "site_stuff" depends on "site_stuff", which is an circular dependency. You can do this: generic_files = FileList["foo", "bar", "baz"].collect { |fn| lambda { fn } } -- -- Jim Weirich -- Posted via http://www.ruby-forum.com/.