Support (indeed, require) the precompilation of templates. This is accomplished through the new makefile. Just run a "make install" to pick up any changes in populatedb.pl and to recompile any changed templates.

This commit is contained in:
zach%zachlipton.com 2005-09-07 02:25:57 +00:00
Родитель a9bd34f655
Коммит c165506090
4 изменённых файлов: 48 добавлений и 2 удалений

Просмотреть файл

@ -30,7 +30,6 @@ our $version = "0.0.2";
# if true, then Litmus will not accept any requests
our $disabled = 0;
our $user_cookiename = "litmus_logincookie_002";
our $sysconfig_cookiename = "litmus_sysconfig";
our $datadir = "data/";
1;

Просмотреть файл

@ -126,6 +126,8 @@ sub create {
PRE_PROCESS => "variables.none.tmpl",
POST_CHOMP => 1,
COMPILE_DIR => $Litmus::Config::datadir,
FILTERS => {
# disallow all html in testcase data except for non-evil tags
testdata => sub {

42
webtools/litmus/Makefile Executable file
Просмотреть файл

@ -0,0 +1,42 @@
# Litmus Makefile
PERL=perl
install: compile
$(PERL) populatedb.pl
# precompile all templates with the Template Toolkit
# to speed things up a good bit.
# This ought to be done in a more "makelike" way, but
# various difficulties prevent that unless we use a configure
# script to generate the Makefile, at which point we could have
# been done already...
%.tmpl:
$(PERL) -e " \
eval('use CGI qw(-no_debug)'); \
use Litmus::Template \
\$$template = Litmus::Template->create(); \
\$$template->context()->template('$@'); \
"
compile:
$(PERL) -e " \
use File::Find; \
find({ wanted => sub { \
\$$name = \$$File::Find::name; \
return if (-d \$$name); \
return if (\$$name =~ /\/CVS\//); \
return if (\$$name !~ /\.tmpl\$$/); \
\$$name =~ s/templates\/en\/default\///; \
if (-M 'templates/en/default/'.\$$name < -M 'data/templates/en/default/'.\$$name) { \
system("make", "\$$name"); \
} \
}, no_chdir => 1 }, 'templates/en/default'); \
"
# tags: generate ctags style hints for ease of editing
# requires Exuberant Ctags to be installed (http://ctags.sf.net/)
ctags:
`which ctags` --excmd=number --tag-relative=no --fields=+a+m+n+S -R `pwd`

Просмотреть файл

@ -26,6 +26,7 @@ BEGIN {
unless (-e "data/") {
system("mkdir data/");
}
system("chmod -R 777 data/");
unless (-e "localconfig") {
open(OUT, ">localconfig");
print OUT <<EOT;
@ -38,6 +39,8 @@ our \$user_cookiename = "litmus_login";
our \$sysconfig_cookiename = "litmustestingconfiguration";
EOT
close(OUT);
print "Go edit 'localconfig' with your configuration and \n";
print "run this script again.";
exit;
}
}