Dave Miller wrote:
> We picked up the upgrade to perl-Template-Toolkit 2.20 off rpmforge last
> night, and our website build scripts that use it failed to recurse
> subdirectories when building the website.

Hi Dave,

 From the Changes:

ttree
-----

* Changed the --accept option in ttree to match against the full file
   path (relative to --src dir) rather than just the file name.  This
   makes it behave the same way as the --ignore option.

Here's the specific change:

http://template-toolkit.org/svnweb/Template2/diff/trunk/bin/ttree?rev1=1074;rev2=1075

The accept list used to be checked against the file name only and all
directories were accepted unconditionally if the recurse option was set.
The downside was that it wasn't possible to only accept a single directory.

The change fixed that so you can write:

    $ ttree --accept just/this/directory

The drawback is that your accept option no longer works:

> accept = \.html$

Sorry about that.  :-(

One work-around would be to not use the accept option and rely on your
ignore list to avoid unwelcome files.  Another would be to list each
directory as an accept option.

   accept = download
   accept = contribute
   ...etc...

Both are sub-optimal, so it's clear that ttree needs to be fixed better.

Possible options are:

   - to explicitly add a '/' (or platform specific separator) to the end of
     directory paths that tree checks against so that you can "accept = /$"
     to accept all directories (currently there's no way to tell from the
     path if it's a directory or file).

   - to add --accept_dirs and --accept_files options to allow you to provide
     different accept lists for dirs and files.  Then you could write
     "accept_dirs = .*" and "accept_files = \.html$".  And/or an all_dirs

   - to enter directories unconditionally if the recurse option is set and
     figure out some other way of specifying that you only want to visit
     certain directories.

That last one is the easiest to implement (although it's little more than
regressing the previous "fix").  If you're keen to upgrade to 2.20 and just
want to fix ttree then you can change line 258 as follows:

- unless (grep { $path =~ /$_/ } @$accept) {
+ unless ((-d $abspath && $recurse) || grep { $path =~ /$_/ } @$accept) {

That'll should get things working for you until I can come up with a proper
solution.

HTH
A

_______________________________________________
templates mailing list
templates@template-toolkit.org
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to