Permalink
Browse files

move code from bin/build to bin/xml

  • Loading branch information...
1 parent 7fa1986 commit 646eb55b2fad24eaa8817430e47b445af5a96055 gabor committed May 30, 2010
Showing with 38 additions and 57 deletions.
  1. +0 −50 bin/build
  2. +38 −7 bin/xml
View
@@ -1,50 +0,0 @@
-#!/usr/bin/perl -w
-
-use strict;
-use File::Copy;
-use File::Find::Rule;
-use File::Path;
-use File::Spec::Functions qw(splitpath);
-use Template;
-
-my $tt = Template->new({
- PRE_PROCESS => 'macros',
- POST_CHOMP => 1,
- PRE_CHOMP => 1,
- TRIM => 1,
- EVAL_PERL => 1 ,
- INCLUDE_PATH => ['.', 'lib', 'src'],
-});
-
-my $source = 'src';
-my $destination = 'www';
-my $parms;
-
-my $rule = File::Find::Rule->new;
-$rule->or(
- $rule->new->directory->name('.svn')->prune->discard,
- $rule->new->directory->name('census')->prune->discard,
- $rule->new
-);
-my @files = $rule->file()->name(qr/^.[^~]+$/)->in($source);
-
-foreach my $file (@files) {
- next if $file eq 'src/groups/index.html'; # processed by bin/xml
-
- print STDERR $file, "\n";
-
- my $destfile = $file;
- $destfile =~ s/^$source/$destination/;
- my($volume, $directories, $filepart) = splitpath($destfile);
- mkpath $directories;
- warn "$file -> $destfile\n";
-
- if ($file =~ /\.png$/) {
- copy($file, $destfile);
- } else {
- $tt->process($file, $parms, $destfile) || die $tt->error;
- }
-}
-
-
-
View
45 bin/xml
@@ -1,7 +1,10 @@
#!/usr/bin/perl -w
use strict;
-use File::Copy;
+use File::Copy qw(copy);
+use File::Find::Rule;
+use File::Path qw(mkpath);
+use File::Spec::Functions qw(splitpath);
use Template;
use XML::LibXML;
@@ -135,14 +138,42 @@ foreach my $continent (@continents) {
}
{
- my $conf = {
- allgroups => \%allgroups,
- allgroupsnum => scalar(keys %allgroups),
- };
- $tt->process('src/groups/index.html', $conf, "www/groups/index.html")
- || die $tt->error();
+ my $source = 'src';
+ my $destination = 'www';
+ my $parms = {
+ allgroups => \%allgroups,
+ allgroupsnum => scalar(keys %allgroups),
+ };
+
+ my $rule = File::Find::Rule->new;
+ $rule->or(
+ $rule->new->directory->name('.svn')->prune->discard,
+ $rule->new->directory->name('census')->prune->discard,
+ $rule->new
+ );
+ my @files = $rule->file()->name(qr/^.[^~]+$/)->in($source);
+
+ foreach my $file (@files) {
+ #next if $file eq 'src/groups/index.html'; # processed by bin/xml
+
+ print STDERR $file, "\n";
+
+ my $destfile = $file;
+ $destfile =~ s/^$source/$destination/;
+ my($volume, $directories, $filepart) = splitpath($destfile);
+ mkpath $directories;
+ warn "$file -> $destfile\n";
+
+ if ($file =~ /\.png$/) {
+ copy($file, $destfile);
+ } else {
+ $tt->process($file, $parms, $destfile) || die $tt->error;
+ }
+ }
}
+
+
__END__
=head1 NAME

0 comments on commit 646eb55

Please sign in to comment.