Skip to content

Commit

Permalink
*** empty log message ***
Browse files Browse the repository at this point in the history
git-svn-id: svn://svn.tt2.org/tt/Template2/trunk@54 d5a88997-0a34-4036-9ed2-92fb5d660d91
  • Loading branch information
abw committed Oct 9, 2000
1 parent 9de6bd5 commit 48634a1
Show file tree
Hide file tree
Showing 4 changed files with 625 additions and 28 deletions.
2 changes: 2 additions & 0 deletions MANIFEST
Expand Up @@ -31,6 +31,7 @@ lib/Template/Parser.pod
lib/Template/Plugin.pm lib/Template/Plugin.pm
lib/Template/Plugin.pod lib/Template/Plugin.pod
lib/Template/Plugin/CGI.pm lib/Template/Plugin/CGI.pm
lib/Template/Plugin/DBI.pm
lib/Template/Plugin/Datafile.pm lib/Template/Plugin/Datafile.pm
lib/Template/Plugin/Date.pm lib/Template/Plugin/Date.pm
lib/Template/Plugin/Dumper.pm lib/Template/Plugin/Dumper.pm
Expand Down Expand Up @@ -72,6 +73,7 @@ t/config.t
t/context.t t/context.t
t/datafile.t t/datafile.t
t/date.t t/date.t
t/dbi.t
t/directive.t t/directive.t
t/document.t t/document.t
t/dom.t t/dom.t
Expand Down
149 changes: 121 additions & 28 deletions Makefile.PL
Expand Up @@ -4,43 +4,68 @@ select STDERR;
$| = 1; $| = 1;
select STDOUT; select STDOUT;


warn(<<EOF); my $DBI_CONFIG_FILE = 't/dbi_test.cfg';


Template Toolkit Version 2.00 beta 5 print <<EOF;
------------------------------------ Template Toolkit Version 2.00
-----------------------------
EOF

#------------------------------------------------------------------------
# check for pre-version 2.00 installation and issue warning
#------------------------------------------------------------------------

eval "use Template";
unless ($@ or $Template::VERSION =~ /^2/) {
warn(<<EOF);
IMPORTANT NOTE:
You have version $Template::VERSION of the Template Toolkit installed.
This is rock-solid and ready-to-rumble beta code, and is the final There are some minor incompatabilities between version 1.* and 2.*
release candidate for Version 2.00 proper. Please read the README of the Template Toolkit which you should be aware of. Installing
file and consult the Changes and TODO files for further this version will overwrite your version $Template::VERSION files
information. unless you take measures to install one or the other version in a
different location (i.e. perl Makefile.PL LIB=/other/path).
Please consult the README and Changes file for further details.
Most of the changes are in the more obscure features and
directives so hopefully you will find the upgrade process fairly
painless.
EOF EOF
exit unless prompt("Do you want to continue?", 'y') =~ /y/i;
}

#------------------------------------------------------------------------
# detect additional modules required by plugins (just for fun)
#------------------------------------------------------------------------


print <<EOF;
The Template Toolkit includes a number of plugin modules, some of which
interface to external Perl modules available from CPAN. All the plugins
will be installed regardless (so that they will work automatically if and
when you install the relevant modules) but the tests will be skipped for
plugins that require external modules not available on your system.
eval "use Template";
unless ($@) {
warn(<<EOF) unless $Template::VERSION =~ /^2/;
IMPORTANT NOTE:
--------------
Version $Template::VERSION of the Template Toolkit detected.
If you install these modules you will totally screw up your
Version $Template::VERSION installation. If you're ready to take
the plunge and aren't relying too heavily on any of the "features"
that have changed from version 1.xx to 2.xx then go ahead, be
bold. See the README file for further details.
EOF EOF

foreach my $module (qw( XML::DOM XML::RSS XML::XPath DBI )) {
eval "use $module";
if ($@) {
print " $module: not found - skipping test\n";
}
else {
print " $module found - including test\n";
dbi_config() if $module eq 'DBI';
}
} }




# my $man3pods = { #------------------------------------------------------------------------
# map { ("docs/pod/$_.pod" # build options and write Makefile
# => "\$(INST_MAN3DIR)/Template::$_.\$(MAN3EXT)") } #------------------------------------------------------------------------
# qw( Base Config Constants Context Document Exception Filters
# Iterator Parser Plugin Plugins Provider Service Stash Test )
# };
# $man3pods->{'docs/pod/Template.pod'} = '$(INST_MAN3DIR)/Template.$(MAN3EXT)';


my %opts = ( my %opts = (
'NAME' => 'Template', 'NAME' => 'Template',
Expand All @@ -49,7 +74,6 @@ my %opts = (
'EXE_FILES' => [ 'bin/tpage', 'bin/ttree' ], 'EXE_FILES' => [ 'bin/tpage', 'bin/ttree' ],
'PMLIBDIRS' => [ 'lib' ], 'PMLIBDIRS' => [ 'lib' ],
'PREREQ_PM' => { 'AppConfig' => 1.52 }, 'PREREQ_PM' => { 'AppConfig' => 1.52 },
# 'MAN3PODS' => $man3pods,
'dist' => { 'dist' => {
'COMPRESS' => 'gzip', 'COMPRESS' => 'gzip',
'SUFFIX' => 'gz', 'SUFFIX' => 'gz',
Expand All @@ -66,6 +90,14 @@ if ($ExtUtils::MakeMaker::VERSION >= 5.43) {
WriteMakefile( %opts ); WriteMakefile( %opts );




#========================================================================


#------------------------------------------------------------------------
# build_docs()
#
# Echo the relevant incantation so that 'make dist' regenerates the
# documentation from the template sources.
#------------------------------------------------------------------------ #------------------------------------------------------------------------


sub build_docs { sub build_docs {
Expand All @@ -75,3 +107,64 @@ echo "Building documentation for version \$(VERSION)" ; \\
EOF EOF
} }



#------------------------------------------------------------------------
# dbi_config()
#
# Quiz the user for options related to running the DBI tests.
#------------------------------------------------------------------------

sub dbi_config {
my ($dsn, $user, $pass, $run);
$run = 1;

print "\nConfiguration for DBI tests\n";

if (prompt("- Do you want to run the DBI tests?\n" .
" It requires access to an existing test database.",
"y") =~ /y/i) {

my ($driver, $dbname);
my @drivers = DBI->available_drivers();
local $" = ', ';

my $default = (grep(/m.?sql/i, @drivers))[0];

print "- Please enter the driver name for the test database.\n";
print " The DBD drivers installed on your system are\n\n";
print " @drivers\n\n";

while (! $driver) {
$driver = prompt("- Enter driver name: ", $default);
print("! No such DBD driver\n"), undef $driver
unless grep(/^$driver$/, @drivers);
}

while (! $dbname) {
$dbname = prompt('- Enter database name: ', 'test');
}

$dsn = "dbi:$driver:$dbname";

$user = prompt('- Enter user name : ', '');
$pass = prompt('- Enter password : ', '');

$user = '' unless defined $user;
$pass = '' unless defined $pass;
}
else {
$run = 0;
}

print "- writing $DBI_CONFIG_FILE\n";
open(CFGFILE, ">$DBI_CONFIG_FILE") || die "$DBI_CONFIG_FILE: $!\n";
print CFGFILE <<EOF;
\$run = $run;
\$dsn = '$dsn';
\$user = '$user';
\$pass = '$pass';
1;
EOF
close(CFGFILE);
}

0 comments on commit 48634a1

Please sign in to comment.