зеркало из https://github.com/mozilla/pjs.git
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:
Родитель
c0d8069753
Коммит
28bfd64107
|
@ -30,7 +30,6 @@ our $version = "0.0.2";
|
||||||
# if true, then Litmus will not accept any requests
|
# if true, then Litmus will not accept any requests
|
||||||
our $disabled = 0;
|
our $disabled = 0;
|
||||||
|
|
||||||
our $user_cookiename = "litmus_logincookie_002";
|
our $datadir = "data/";
|
||||||
our $sysconfig_cookiename = "litmus_sysconfig";
|
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|
|
@ -126,6 +126,8 @@ sub create {
|
||||||
PRE_PROCESS => "variables.none.tmpl",
|
PRE_PROCESS => "variables.none.tmpl",
|
||||||
POST_CHOMP => 1,
|
POST_CHOMP => 1,
|
||||||
|
|
||||||
|
COMPILE_DIR => $Litmus::Config::datadir,
|
||||||
|
|
||||||
FILTERS => {
|
FILTERS => {
|
||||||
# disallow all html in testcase data except for non-evil tags
|
# disallow all html in testcase data except for non-evil tags
|
||||||
testdata => sub {
|
testdata => sub {
|
||||||
|
|
|
@ -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/") {
|
unless (-e "data/") {
|
||||||
system("mkdir data/");
|
system("mkdir data/");
|
||||||
}
|
}
|
||||||
|
system("chmod -R 777 data/");
|
||||||
unless (-e "localconfig") {
|
unless (-e "localconfig") {
|
||||||
open(OUT, ">localconfig");
|
open(OUT, ">localconfig");
|
||||||
print OUT <<EOT;
|
print OUT <<EOT;
|
||||||
|
@ -38,6 +39,8 @@ our \$user_cookiename = "litmus_login";
|
||||||
our \$sysconfig_cookiename = "litmustestingconfiguration";
|
our \$sysconfig_cookiename = "litmustestingconfiguration";
|
||||||
EOT
|
EOT
|
||||||
close(OUT);
|
close(OUT);
|
||||||
|
print "Go edit 'localconfig' with your configuration and \n";
|
||||||
|
print "run this script again.";
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче