Line # Revision Author
1 8 ahitrov@rambler.ru #!/usr/bin/perl
2
3 ##############################################################################
4 # $HeadURL: svn://cvs1.rambler.ru/cndinst/trunk/skel/GNUmakefile $
5 # $Id: GNUmakefile 47 2006-06-08 08:45:46Z lonerr $
6 ###############################################################################
7
8 use strict;
9 use warnings "all";
10
11 my ($proj_src, $proj_usr, $proj_name, $pregen_glob);
12
13 use FindBin;
14 BEGIN {
15 ($proj_src, $proj_usr, $proj_name, $pregen_glob) = splice @ARGV, 0, 4;
16 exit unless @ARGV;
17 require "$proj_usr/$proj_name/lib/Modules.pm";
18 }
19
20 use locale;
21 use Data::Dumper;
22 use Contenido::Globals;
23 use Contenido::Init;
24 use HTML::Mason;
25
26
27 my %pregen_glob = map {$_=>1} split / /, $pregen_glob;
28
29 Contenido::Init->init();
30 $keeper = Contenido::Keeper->new($state) if $pregen_glob{keeper};
31
32 my $buf;
33 my $interp = HTML::Mason::Interp->new(
34 autohandler_name => '',
35 comp_root => "$proj_src/$proj_name/comps",
36 out_method => \$buf,
37 );
38
39 {
40 $interp->compiler->allow_globals(map {"\$$_"} keys %pregen_glob);
41 no strict "refs";
42 $interp->set_global("\$$_" => $$_) for keys %pregen_glob;
43 }
44
45 for my $set (map {"$proj_src/$proj_name/comps/$_"} @ARGV) {
46 for (glob $set) {
47 die "No such static: $_\n" unless -f;
48 s|$proj_src/$proj_name/comps/*|/|;
49 $buf = '';
50 $interp->exec($_);
51 open ST, ">$proj_usr/$proj_name/comps$_" or die $!;
52 print ST $buf;
53 close ST;
54 print "created $proj_usr/$proj_name/comps$_\n";
55 }
56 }