[Cook] Help wanted with unorthodox use of cook
Pendergraft, Jerry
JPendergraft at sjm.com
Sat Mar 3 02:07:48 EST 2007
Yes cook can do the things you want. And I'd be happy to contribute some cook fragments.
But it is not clear from this email what your process is beyond include dependencies? I have not yet taken time to peruse your Nancy web info...
Are you producing "output" html files with the includes expanded in them? If so then those are your build product and cook just needs to know when to re-build them based on calculated dependencies. And if that process uses something like -I/a/b/c to find the includes, it will be quite simple to deal with.
The cook features that can help with this is "cascade dependencies", and the resolve function.
It can also support a baseline and change structure so you need not have all sources in the same directory tree.
Jerry Pendergraft voice:651-523-6935
St.Jude Medical mobil:651-491-0163
Atrial Fibrillation Division email:jpendergraft at sjm.com
1350 Energy Lane
St.Paul, MN 55108
-----Original Message-----
From: cook-users-bounces+jpendergraft=sjm.com at auug.org.au on behalf of Reuben Thomas
Sent: Thu 01-Mar-07 19:53
To: Cook users list
Subject: [Cook] Help wanted with unorthodox use of cook
I have a slightly unusual use for cook, but I'm a complete newbie to it and
have little idea how to go about using it for this purpose. I have a very
simple web-templating system to which I want to add support for generated
files, but it occurred to me that this is just reinventing the wheel.
However, apart from cook, none of the make-like systems I investigated
seemed able to straightforwardly do what I want, namely:
1. Have a single top-level makefile that worked for a complete directory
hierarchy.
2. Process non-standard includes dependencies.
Having studied the cook manual and introduction I discovered that cook
handles 1 fine, and probably can do 2 easily, but I'd appreciate any
pointers the experts can give.
Basically, includes work like this in my system: suppose a file
foo/bar/baz/bob.html contains "$include{fragment}". Then a file called
"fragment" is searched for in the following directories, in the following
order: foo/bar/baz, foo/bar, foo, <root>.
So, it's pretty easy to see how to write a script to generate the
dependencies (it's just a simplified version of the program I already wrote,
called nancy: http://rrt.sc3d.org/Software/Nancy). It then needs to be run
on each file in each leaf directory of the hierarchy (the "leaf
directory=web page" rule means that every web page can have per-page
includes that don't conflict with any other page's includes). The simplest
thing I can think of is writing a script that a) finds all the leaf
directories, and b) finds the includes as above. Indeed, I already have
such a script. But I was wondering if that's overkill given cook's
capabilities. It then remains to tell cook how to produce an output file;
the other important detail is that, in order to avoid confusion and allow
fragments to use the same file suffix as web pages, to avoid having to
reprogram editors or file associations, I only do out-of-tree "builds", but
again, cook seems able to cope.
What I'd really appreciate is some moderately precise pointers on how best
to implement each element of this scheme, but any help would be much
appreciated, including of course any mistakes I seem to have made about
cook. I hope to end up with nancy written in cook as a single generic
Howto.cook file that I can use instead of nancy, adding per-project build
rules as necessary for projects that generate include files by other (more
traditional!) means; the motivating example in my case is HTML fragments
generated from XML.
--
http://rrt.sc3d.org/ | impunity, n. wealth (Bierce)
_______________________________________________
Cook-users mailing list
Cook-users at auug.org.au
http://www.auug.org.au/mailman/listinfo/cook-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.auug.org.au/pipermail/cook-users/attachments/20070302/4d2be034/attachment.htm>
More information about the Cook-users
mailing list