7 use File::Spec::Functions qw(updir catdir);
8 use File::Basename qw(dirname);
9 use File::Path qw(rmtree);
10 use File::Copy::Recursive qw(dircopy);
12 our @EXPORT = qw(make_test_app);
14 our $root = abs_path(catdir(dirname(__FILE__), (updir) x 2));
17 my $tmp = "$root/t/tmp";
18 rmtree $tmp if -d $tmp;
21 # create a TestApp and copy the test libs into it
22 my $testapp = "$tmp/TestApp";
26 mkdir "$testapp/script";
28 for my $command (qw(CGI FastCGI Server)) {
29 my $script = "$testapp/script/testapp_\L$command\E.pl";
30 open my $fh, '>:raw', $script
31 or die "can't create $script: $!";
32 print $fh <<"END_CODE";
35 use Catalyst::ScriptRunner;
36 Catalyst::ScriptRunner->run('TestApp', '$command');
44 open my $fh, '>:raw', "$testapp/cpanfile";
47 File::Copy::Recursive::dircopy( "$root/t/lib", "$testapp/lib" );