8 use File::Path qw(make_path);
9 use File::Basename qw (fileparse);
10 use File::Copy::Recursive qw(fcopy);
11 use File::Temp qw (tempdir);
17 #rule to match git directorys
18 my $git = File::Find::Rule->directory
24 my $file_rule = File::Find::Rule->file();
27 my @files = File::Find::Rule->or( $git, $file_rule )
30 #initialize template toolkit
32 my $template = Template->new;
35 make_path($out_dir) or die "Could not create outdir $out_dir: $!";
38 foreach my $file (@files) {
39 next if $file =~ /^$out_dir/;
40 next if $file =~ /$0$/;
41 if ($file =~ /\.tt2$/) {
43 $template->process($file, undef, \$output)
44 || die "Could not process file \"$file\": $!";
46 my ($name,$path,$suffix) = fileparse($file,qw (.tt2));
47 make_path("$out_dir/$path") unless -d "$out_dir/$path";
48 open (my $fh, '>', "$out_dir/$path/$name")
49 or die "Could not write to $file: $!";
53 fcopy ($file, "$out_dir/$file") or die "Could not copy $file to $out_dir/$file: $!";