[Templates] Ignoring config in subdirectories?
Harald Joerg
haj@oook.m.uunet.de
Fri, 04 May 2007 13:15:07 +0200
Garry Heaton <garry@usableit.co.uk> writes:
> I have the following ttree.cfg
>
> ********************************
> src = /var/www/html/orm/tt/src
> lib = /var/www/html/orm/tt/lib
> dest = /var/www/html/orm/pub
>
> ignore = ^#
> ignore = ~$
> ignore = .sh$
>
> [...]
> ********************************
>
> I have a 'go.sh' script:
>
> ttree -f /var/www/html/orm/tt/ttree.cfg $@
>
> When I specify:
>
> ./go.sh -a
>
> ..... all files ending in ~ are ignored, as specified, but if I limit
> myself to a subdirectory with:
>
> ./go.sh about/*
>
> .... then the same files are not ignored and I end up with a 'pub'
> directory full of superfluous files ending in ~.
On first skimming over the code it looks like this is a shortcoming of
ttree. If files are specified explicitly, then the ignore config
options are, well, ignored.
Some workarounds come into my mind:
* The 'accept' configuration variable is evaluated even for individual
files. This helps only if you can "catch" all files you want to
process with some simple regexes.
* You can have more than one -f option on the command line. I
usually have small "extra" config files for subsections of the site
which override just the 'src' and 'dest' parameters (but I don't
recall whether I created them because I stumbled over the same
problem which you are reporting).
* You can override config parameters with command line arguments as
well. This is inconvenient since you'd have to provide both --src
and --dest, and you need to enter absolute file paths.
Maybe ttree should, in its main processing loop, check whether @ARGV
contains directories or files, and then call either process_file or
process_tree? If so, Garry could simply invoke ttree with
./go.sh about
--
Cheers,
haj