From: Sebastian Riedel Date: Sat, 19 Nov 2005 06:30:46 +0000 (+0000) Subject: Renamed tests X-Git-Tag: 5.7099_04~872 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=a2e038a1e9cbc0f1ea32b7087e6b47efe3af082f Renamed tests --- diff --git a/Build.PL b/Build.PL deleted file mode 100644 index 5082039..0000000 --- a/Build.PL +++ /dev/null @@ -1,91 +0,0 @@ -use strict; -use Module::Build; - -my $build = Module::Build->new( - create_makefile_pl => 'passthrough', - license => 'perl', - module_name => 'Catalyst', - requires => { - 'perl' => '5.8.1', - 'UNIVERSAL::require' => "0.10", - 'Class::Accessor::Fast' => 0, - 'Class::Data::Inheritable' => 0, - 'Class::Inspector' => 0, - 'CGI::Cookie' => 0, - 'File::Modified' => 0, - 'HTML::Entities' => 0, - 'HTTP::Body' => 0.5, - 'HTTP::Headers' => 1.59, - 'HTTP::Request' => 0, - 'HTTP::Response' => 0, - 'HTTP::Request::AsCGI' => 0, - 'LWP::UserAgent' => 0, - 'MIME::Types' => 0, - 'Module::Pluggable::Fast' => 0.16, - 'NEXT' => 0, - 'Path::Class' => 0.09, - 'Scalar::Util' => 0, - 'Template' => 0, - 'Text::SimpleTable' => 0, - 'Test::MockObject' => 0, - 'Time::HiRes' => 0, - 'Tree::Simple' => 0, - 'Tree::Simple::Visitor::FindByPath' => 0, - 'URI' => 1.35, - }, - recommends => { - 'Catalyst::Engine::Apache' => '1.00', - FCGI => 0, - 'FCGI::ProcManager' => 0, - PAR => 0 - }, - create_makefile_pl => 'passthrough', - create_readme => 1, - script_files => [ glob('script/*') ], - test_files => [ - glob('t/*.t'), glob('t/*/*.t'), - glob('t/*/*/*.t'), glob('t/*/*/*/*.t'), - glob('t/*/*/*/*/*.t') - ] -); -$build->create_build_script; - -print( '*' x 80, "\n" ); -my $banner = - (qw/andyg chansen draven fordmason mst naughton sri jester/)[ int( rand(8) ) ] - . " is the greatest and gabb is " - . ( (localtime)[2] > 12 ? "drunk" : "hung over" ) - . " again!"; -print " $banner \n"; -print( '*' x 80, "\n" ); - -print <<'EOF'; - - ____ _ _ _ - / ___|__ _| |_ __ _| |_ _ ___| |_ - | | / _` | __/ _` | | | | / __| __| - | |__| (_| | || (_| | | |_| \__ \ |_ - \____\__ _|\__\__ _|_|\__ |___/\__| - |___/ carpe diem! - -EOF - -eval "use FCGI"; -if ($@) { - print qq/ Install "FCGI" for FastCGI support.\n/; -} -else { - eval "use FCGI::ProcManager"; - print -qq/ Install "FCGI::ProcManager" for multiprocess FastCGI external support.\n/ - if ($@); -} -eval "use PAR ()"; -print qq/ Install "PAR" for PAR packaging support.\n/ if $@; - -print <<"EOF"; - - Important: - The Apache engines have been moved to a separate package in Catalyst 5.5. - Please install Catalyst::Engine::Apache if you need Apache support. -EOF diff --git a/lib/Catalyst/Build.pm b/lib/Catalyst/Build.pm deleted file mode 100644 index 7ecdba7..0000000 --- a/lib/Catalyst/Build.pm +++ /dev/null @@ -1,101 +0,0 @@ -package Catalyst::Build; - -use strict; -use Module::Build; -use base 'Module::Build'; -use Path::Class; -use File::Find 'find'; - -our @ignore = - qw/Build Build.PL Changes MANIFEST META.yml Makefile.PL Makefile README - _build blib lib script t/; - -our $FAKE; -our $ignore = '^(' . join( '|', @ignore ) . ')$'; - -=head1 NAME - -Catalyst::Build - Module::Build extension for Catalyst - -=head1 SYNOPSIS - -See L - -=head1 DESCRIPTION - -L extension for Catalyst. - -=head1 METHODS - -=head2 ACTION_install - -=cut - -sub ACTION_install { - my $self = shift; - $self->SUPER::ACTION_install; - $self->ACTION_install_extras; -} - -=head2 ACTION_fakeinstall - -=cut - -sub ACTION_fakeinstall { - my $self = shift; - $self->SUPER::ACTION_fakeinstall; - local $FAKE = 1; - $self->ACTION_install_extras; -} - -=head2 ACTION_install_extras - -=cut - -sub ACTION_install_extras { - my $self = shift; - my $prefix = $self->{properties}{destdir} || undef; - my $sitelib = $self->install_destination('lib'); - my @path = defined $prefix ? ( $prefix, $sitelib ) : ($sitelib); - my $path = dir( @path, split( '::', $self->{properties}{module_name} ) ); - my @files = $self->_find_extras; - print "Installing extras to $path\n"; - for (@files) { - $FAKE - ? print "$_ -> $path (FAKE)\n" - : $self->copy_if_modified( $_, $path ); - } -} - -sub _find_extras { - my $self = shift; - my @all = glob '*'; - my @files; - for my $file (@all) { - next if $file =~ /$ignore/; - if ( -d $file ) { - find( - sub { - return if -d; - push @files, $File::Find::name; - }, - $file - ); - } - else { push @files, $file } - } - return @files; -} - -=head1 AUTHOR - -Sebastian Riedel, C - -=head1 LICENSE - -This library is free software, you can redistribute it and/or modify it under -the same terms as Perl itself. - -=cut - -1; diff --git a/lib/Catalyst/Helper.pm b/lib/Catalyst/Helper.pm index 6a34f7d..db43ce2 100644 --- a/lib/Catalyst/Helper.pm +++ b/lib/Catalyst/Helper.pm @@ -78,14 +78,12 @@ sub mk_app { unless ( $self->{scripts} ) { $self->_mk_dirs; $self->_mk_appclass; - $self->_mk_build; $self->_mk_makefile; $self->_mk_readme; $self->_mk_changes; $self->_mk_apptest; $self->_mk_images; $self->_mk_favicon; - $self->_mk_package; } $self->_mk_cgi; $self->_mk_fastcgi; @@ -339,15 +337,11 @@ sub _mk_appclass { $self->render_file( 'appclass', "$mod.pm" ); } -sub _mk_build { - my $self = shift; - my $dir = $self->{dir}; - $self->render_file( 'build', "$dir\/Build.PL" ); -} - sub _mk_makefile { my $self = shift; - my $dir = $self->{dir}; + $self->{path} = File::Spec->catfile( 'lib', split( '::', $self->{name} ) ); + $self->{path} .= '.pm'; + my $dir = $self->{dir}; $self->render_file( 'makefile', "$dir\/Makefile.PL" ); } @@ -447,14 +441,6 @@ sub _mk_favicon { } -sub _mk_package { - my $self = shift; - my $script = $self->{script}; - my $appprefix = $self->{appprefix}; - $self->render_file( 'package', "$script\/$appprefix\_package.pl" ); - chmod 0700, "$script/$appprefix\_package.pl"; -} - =head1 HELPERS Helpers are classes that provide two methods. @@ -580,52 +566,27 @@ it under the same terms as Perl itself. 1; __makefile__ - unless ( eval "use Module::Build::Compat 0.02; 1" ) { - print "This module requires Module::Build to install itself.\n"; +use inc::Module::Install; - require ExtUtils::MakeMaker; - my $yn = - ExtUtils::MakeMaker::prompt( ' Install Module::Build now from CPAN?', 'y' ); - - unless ( $yn =~ /^y/i ) { - die " *** Cannot install without Module::Build. Exiting ...\n"; - } +name('[% name %]'); +abstract('Catalyst Application'); +author('[% author %]'); +version_from('[% path %]'); +license('perl'); - require Cwd; - require File::Spec; - require CPAN; +requires( Catalyst => '5.5'); - # Save this 'cause CPAN will chdir all over the place. - my $cwd = Cwd::cwd(); - my $makefile = File::Spec->rel2abs($0); +install_script; +tests( glob('t/*.t'), glob('t/*/*.t') ); - CPAN::Shell->install('Module::Build::Compat') - or die " *** Cannot install without Module::Build. Exiting ...\n"; +catalyst_files(); - chdir $cwd or die "Cannot chdir() back to $cwd: $!"; - } - eval "use Module::Build::Compat 0.02; 1" or die $@; - use lib '_build/lib'; - Module::Build::Compat->run_build_pl( args => \@ARGV ); - require Module::Build; - Module::Build::Compat->write_makefile( build_class => 'Module::Build' ); -__build__ -use strict; -use Catalyst::Build; - -my $build = Catalyst::Build->new( - license => 'perl', - module_name => '[% name %]', - requires => { Catalyst => '5.49' }, - create_makefile_pl => 'passthrough', - script_files => [ glob('script/*') ], - test_files => [ glob('t/*.t'), glob('t/*/*.t') ] -); -$build->create_build_script; +&WriteAll; __readme__ Run script/[% appprefix %]_server.pl to test the application. __changes__ This file documents the revision history for Perl extension [% name %]. + 0.01 [% time %] - initial revision, generated by Catalyst __apptest__ @@ -995,86 +956,6 @@ This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself. =cut -__package__ -[% startperl %] - -use strict; -use Getopt::Long; -use Pod::Usage; -use Catalyst::PAR; - -my $core = 0; -my $classes = ''; -my $engine = 'CGI'; -my $help = 0; -my $multiarch = 0; -my $output = '[% appprefix %].par'; - -GetOptions( - 'classes=s' => \$classes, - 'core' => \$core, - 'engine=s' => \$engine, - 'help|?' => \$help, - 'multiarch' => \$multiarch, - 'output=s' => \$output -); - -pod2usage(1) if $help; - -Catalyst::PAR->new->package( { - classes => $classes, - core => $core, - engine => $engine, - multiarch => $multiarch, - output => $output, - class => '[% name %]' -} ); - -1; - -=head1 NAME - -[% appprefix %]_package.pl - Package Catalyst Applications - -=head1 SYNOPSIS - -[% appprefix %]_package.pl - - Options: - -classes comma separated list of additional classes to - include in package - -core also include modules bundled with Perl (defaults to false) - -engine engine to use for dependency detection (defaults to CGI) - -help display this help and exits - -multiarch enable multiarch support (defaults to false) - -output name for the par archive (defaults to [% appprefix %].par) - - Examples: - [% appprefix %]_package.pl -engine FastCGI - [% appprefix %]_package.pl -o foo_linux_i386_apache2.par -engine Apache2 - [% appprefix %]_package.pl -classes Test::More,Foo::Bar -o foo.par - - See also: - perldoc Catalyst::Manual - perldoc Catalyst::Manual::Intro - perldoc pp - -=head1 DESCRIPTION - -Package Catalyst Applications with L. - -=head1 AUTHOR - -Sebastian Riedel, C - -=head1 COPYRIGHT - -Copyright 2004 Sebastian Riedel. All rights reserved. - -This library is free software, you can redistribute it and/or modify -it under the same terms as Perl itself. - -=cut __compclass__ package [% class %]; diff --git a/lib/Catalyst/PAR.pm b/lib/Catalyst/PAR.pm deleted file mode 100644 index d74ed9c..0000000 --- a/lib/Catalyst/PAR.pm +++ /dev/null @@ -1,127 +0,0 @@ -package Catalyst::PAR; - -use strict; -use base 'Class::Accessor::Fast'; -use FindBin; -use IO::File; -use File::Spec; -use File::Find; -require Catalyst; - -=head1 NAME - -Catalyst::PAR - Package Catalyst Applications - -=head1 SYNOPSIS - -See L - -=head1 DESCRIPTION - -Package Catalyst Applications. - -=head1 METHODS - -=head2 $self->package(\%options) - -=cut - -sub package { - my ( $self, $options ) = @_; - - my $par = $options->{output} || 'application.par'; - my $engine = $options->{engine} || 'CGI'; - - # Check for PAR - eval "use PAR ()"; - die "Please install PAR" if $@; - eval "use PAR::Packer ()"; - die "Please install PAR::Packer" if $@; - eval "use App::Packer::PAR ()"; - die "Please install App::Packer::PAR" if $@; - eval "use Module::ScanDeps ()"; - die "Please install Module::ScanDeps" if $@; - - chdir File::Spec->catdir( $FindBin::Bin, '..' ); - - # Find additional files - my @files; - finddepth( - sub { - my $name = $File::Find::name; - return if $name =~ /^\W*lib/; - return if $name =~ /^\W*blib/; - return if $name =~ /^\W*_build/; - return if $name =~ /\.par$/; - return if $name !~ /\w+/; - push @files, $name; - }, - '.' - ); - - my $par_test = File::Spec->catfile( $FindBin::Bin, '..', 'par_test.pl' ); - unlink $par_test; - - my $classes = ''; - for my $req ( split ',', $options->{classes} ) { - $classes .= "require $req;\n"; - } - my $version = $Catalyst::VERSION; - my $class = $options->{class}; - my $tmp_file = IO::File->new("> $par_test"); - print $tmp_file <<"EOF"; -die "$class on Catalyst $version\n" if \$0 !~ /par_test.pl\.\\w+\$/; -BEGIN { \$ENV{CATALYST_ENGINE} = '$engine' }; -use lib 'lib'; -require $class; -import $class; -require Catalyst::Helper; -require Catalyst::PAR; -require Catalyst::Build; -require Catalyst::Test; -require Catalyst::Engine::HTTP; -require Catalyst::Engine::CGI; -require Catalyst::Controller; -require Catalyst::Model; -require Catalyst::View; -$classes -EOF - $tmp_file->close; - - # Create package - local $SIG{__WARN__} = sub { }; - open my $olderr, '>&STDERR'; - open STDERR, '>', File::Spec->devnull; - my %opt = ( - 'x' => 1, - 'n' => 0, - 'o' => $par, - 'a' => [@files], - 'p' => 1, - 'B' => $options->{core}, - 'm' => $options->{multiarch} - ); - App::Packer::PAR->new( - frontend => 'Module::ScanDeps', - backend => 'PAR::Packer', - frontopts => \%opt, - backopts => \%opt, - args => ['par_test.pl'], - )->go; - open STDERR, '>&', $olderr; - - unlink $par_test; -} - -=head1 AUTHOR - -Sebastian Riedel, C - -=head1 LICENSE - -This library is free software, you can redistribute it and/or modify it under -the same terms as Perl itself. - -=cut - -1; diff --git a/lib/Module/Install/Catalyst.pm b/lib/Module/Install/Catalyst.pm new file mode 100644 index 0000000..416dd37 --- /dev/null +++ b/lib/Module/Install/Catalyst.pm @@ -0,0 +1,188 @@ +package Module::Install::Catalyst; + +use strict; +use base 'Module::Install::Base'; +use File::Find; +use FindBin; +use File::Copy::Recursive 'rcopy'; +use File::Spec (); + +our @IGNORE = + qw/Build Build.PL Changes MANIFEST META.yml Makefile.PL Makefile README + _build blib lib script t inc/; +our $ENGINE = 'CGI'; +our $CORE = 0; +our $MULTIARCH = 0; + +=head1 NAME + +Module::Install::Catalyst - Module::Install extension for Catalyst + +=head1 SYNOPSIS + +See L + +=head1 DESCRIPTION + +L extension for Catalyst. + +=head1 METHODS + +=head2 catalyst_files + +=cut + +sub catalyst_files { + my $self = shift; + + chdir $FindBin::Bin; + + my @files; + opendir CATDIR, '.'; + CATFILES: for my $name ( readdir CATDIR ) { + for my $ignore (@IGNORE) { + next CATFILES if $name =~ /^$ignore$/; + next CATFILES if $name !~ /\w/; + } + push @files, $name; + } + closedir CATDIR; + my @path = split '::', $self->name; + for my $orig (@files) { + my $path = File::Spec->catdir( 'blib', 'lib', @path, $orig ); + rcopy( $orig, $path ); + } +} + +=head2 catalyst_ignore_all(\@ignore) + +=cut + +sub catalyst_ignore_all { + my ( $self, $ignore ) = @_; + @IGNORE = @$ignore; +} + +=head2 catalyst_ignore(\@ignore) + +=cut + +sub catalyst_ignore { + my ( $self, @ignore ) = @_; + push @IGNORE, @ignore; +} + +=head2 catalyst_par($name) + +=cut + +sub catalyst_par { + my ( $self, $par ) = @_; + + $par ||= 'application.par'; + my $engine = $ENGINE || 'CGI'; + + # Check for PAR + eval "use PAR ()"; + die "Please install PAR" if $@; + eval "use PAR::Packer ()"; + die "Please install PAR::Packer" if $@; + eval "use App::Packer::PAR ()"; + die "Please install App::Packer::PAR" if $@; + eval "use Module::ScanDeps ()"; + die "Please install Module::ScanDeps" if $@; + + my $root = $FindBin::Bin; + chdir File::Spec->catdir( $root, 'blib' ); + + my $par_pl = 'par.pl'; + unlink $par_pl; + + my $version = $Catalyst::VERSION; + my $class = $self->name; + + my $tmp_file = IO::File->new("> $par_pl"); + print $tmp_file <<"EOF"; +die "$class on Catalyst $version\n" if \$0 !~ /par.pl\.\\w+\$/; +BEGIN { \$ENV{CATALYST_ENGINE} = '$engine' }; +use lib 'lib'; +require $class; +import $class; +require Catalyst::Helper; +require Catalyst::PAR; +require Catalyst::Build; +require Catalyst::Test; +require Catalyst::Engine::HTTP; +require Catalyst::Engine::CGI; +require Catalyst::Controller; +require Catalyst::Model; +require Catalyst::View; +EOF + $tmp_file->close; + + # Create package + local $SIG{__WARN__} = sub { }; + open my $olderr, '>&STDERR'; + open STDERR, '>', File::Spec->devnull; + my %opt = ( + 'x' => 1, + 'n' => 0, + 'o' => $par, + 'a' => [ grep( !/par.pl/, glob '.' ) ], + 'p' => 1, + 'B' => $CORE, + 'm' => $MULTIARCH + ); + App::Packer::PAR->new( + frontend => 'Module::ScanDeps', + backend => 'PAR::Packer', + frontopts => \%opt, + backopts => \%opt, + args => ['par.pl'], + )->go; + open STDERR, '>&', $olderr; + + unlink $par_pl; + chdir $root; + rmove File::Spec->catfile( 'blib', $par ), $par; +} + +=head2 catalyst_par_core($core) + +=cut + +sub catalyst_par_core { + my ( $self, $core ) = @_; + $CORE = $core; +} + +=head2 catalyst_par_engine($engine) + +=cut + +sub catalyst_par_engine { + my ( $self, $engine ) = @_; + $ENGINE = $engine; +} + +=head2 catalyst_par_multiarch($multiarch) + +=cut + +sub catalyst_par_multiarch { + my ( $self, $multiarch ) = @_; + $MULTIARCH = $multiarch; +} + +=head1 AUTHOR + +Sebastian Riedel, C + +=head1 LICENSE + +This library is free software, you can redistribute it and/or modify it under +the same terms as Perl itself. + +=cut + +1; diff --git a/t/lib/TestApp/Controller/Action/Streaming.pm b/t/lib/TestApp/Controller/Action/Streaming.pm index 775eaba..ef475e4 100644 --- a/t/lib/TestApp/Controller/Action/Streaming.pm +++ b/t/lib/TestApp/Controller/Action/Streaming.pm @@ -17,7 +17,7 @@ EOF sub body : Local { my ( $self, $c ) = @_; - my $file = "$FindBin::Bin/../../../../01use.t"; + my $file = "$FindBin::Bin/01use.t"; my $fh = IO::File->new( $file, 'r' ); if ( defined $fh ) { $c->res->body( $fh ); diff --git a/t/live_component_controller_action_auto.t b/t/live_component_controller_action_auto.t index f99d4ad..9c9e83b 100644 --- a/t/live_component_controller_action_auto.t +++ b/t/live_component_controller_action_auto.t @@ -4,7 +4,7 @@ use strict; use warnings; use FindBin; -use lib "$FindBin::Bin/../../../lib"; +use lib "$FindBin::Bin/lib"; our $iters; diff --git a/t/live_component_controller_action_begin.t b/t/live_component_controller_action_begin.t index ab65643..6e97a67 100644 --- a/t/live_component_controller_action_begin.t +++ b/t/live_component_controller_action_begin.t @@ -4,7 +4,7 @@ use strict; use warnings; use FindBin; -use lib "$FindBin::Bin/../../../lib"; +use lib "$FindBin::Bin/lib"; our $iters; diff --git a/t/live_component_controller_action_default.t b/t/live_component_controller_action_default.t index 2e1d68b..1a2e545 100644 --- a/t/live_component_controller_action_default.t +++ b/t/live_component_controller_action_default.t @@ -4,7 +4,7 @@ use strict; use warnings; use FindBin; -use lib "$FindBin::Bin/../../../lib"; +use lib "$FindBin::Bin/lib"; our $iters; diff --git a/t/live_component_controller_action_detach.t b/t/live_component_controller_action_detach.t index adc5c8e..42a9fe0 100644 --- a/t/live_component_controller_action_detach.t +++ b/t/live_component_controller_action_detach.t @@ -4,7 +4,7 @@ use strict; use warnings; use FindBin; -use lib "$FindBin::Bin/../../../lib"; +use lib "$FindBin::Bin/lib"; our $iters; diff --git a/t/live_component_controller_action_end.t b/t/live_component_controller_action_end.t index 8462170..161caa0 100644 --- a/t/live_component_controller_action_end.t +++ b/t/live_component_controller_action_end.t @@ -4,7 +4,7 @@ use strict; use warnings; use FindBin; -use lib "$FindBin::Bin/../../../lib"; +use lib "$FindBin::Bin/lib"; our $iters; diff --git a/t/live_component_controller_action_forward.t b/t/live_component_controller_action_forward.t index db1c8ea..58d0ed4 100644 --- a/t/live_component_controller_action_forward.t +++ b/t/live_component_controller_action_forward.t @@ -4,7 +4,7 @@ use strict; use warnings; use FindBin; -use lib "$FindBin::Bin/../../../lib"; +use lib "$FindBin::Bin/lib"; our $iters; diff --git a/t/live_component_controller_action_global.t b/t/live_component_controller_action_global.t index 13287a6..948ed9f 100644 --- a/t/live_component_controller_action_global.t +++ b/t/live_component_controller_action_global.t @@ -4,7 +4,7 @@ use strict; use warnings; use FindBin; -use lib "$FindBin::Bin/../../../lib"; +use lib "$FindBin::Bin/lib"; our $iters; diff --git a/t/live_component_controller_action_index.t b/t/live_component_controller_action_index.t index cd4f9b0..697e61f 100644 --- a/t/live_component_controller_action_index.t +++ b/t/live_component_controller_action_index.t @@ -4,7 +4,7 @@ use strict; use warnings; use FindBin; -use lib "$FindBin::Bin/../../../lib"; +use lib "$FindBin::Bin/lib"; our $iters; diff --git a/t/live_component_controller_action_inheritance.t b/t/live_component_controller_action_inheritance.t index f13b0e6..3c302d2 100644 --- a/t/live_component_controller_action_inheritance.t +++ b/t/live_component_controller_action_inheritance.t @@ -4,7 +4,7 @@ use strict; use warnings; use FindBin; -use lib "$FindBin::Bin/../../../lib"; +use lib "$FindBin::Bin/lib"; our $iters; diff --git a/t/live_component_controller_action_local.t b/t/live_component_controller_action_local.t index 1d85bee..6a5eefb 100644 --- a/t/live_component_controller_action_local.t +++ b/t/live_component_controller_action_local.t @@ -4,7 +4,7 @@ use strict; use warnings; use FindBin; -use lib "$FindBin::Bin/../../../lib"; +use lib "$FindBin::Bin/lib"; our $iters; diff --git a/t/live_component_controller_action_multipath.t b/t/live_component_controller_action_multipath.t index faa043b..1d38cc6 100644 --- a/t/live_component_controller_action_multipath.t +++ b/t/live_component_controller_action_multipath.t @@ -4,7 +4,7 @@ use strict; use warnings; use FindBin; -use lib "$FindBin::Bin/../../../lib"; +use lib "$FindBin::Bin/lib"; my $content = q/foo bar diff --git a/t/live_component_controller_action_path.t b/t/live_component_controller_action_path.t index 24aeffe..52cd73a 100644 --- a/t/live_component_controller_action_path.t +++ b/t/live_component_controller_action_path.t @@ -4,7 +4,7 @@ use strict; use warnings; use FindBin; -use lib "$FindBin::Bin/../../../lib"; +use lib "$FindBin::Bin/lib"; our $iters; diff --git a/t/live_component_controller_action_private.t b/t/live_component_controller_action_private.t index 6ca0580..c3858df 100644 --- a/t/live_component_controller_action_private.t +++ b/t/live_component_controller_action_private.t @@ -4,7 +4,7 @@ use strict; use warnings; use FindBin; -use lib "$FindBin::Bin/../../../lib"; +use lib "$FindBin::Bin/lib"; our $iters; diff --git a/t/live_component_controller_action_regexp.t b/t/live_component_controller_action_regexp.t index f67d0f9..49f7460 100644 --- a/t/live_component_controller_action_regexp.t +++ b/t/live_component_controller_action_regexp.t @@ -4,7 +4,7 @@ use strict; use warnings; use FindBin; -use lib "$FindBin::Bin/../../../lib"; +use lib "$FindBin::Bin/lib"; our $iters; diff --git a/t/live_component_controller_action_streaming.t b/t/live_component_controller_action_streaming.t index c7e1c79..3adf4b4 100644 --- a/t/live_component_controller_action_streaming.t +++ b/t/live_component_controller_action_streaming.t @@ -4,7 +4,7 @@ use strict; use warnings; use FindBin; -use lib "$FindBin::Bin/../../../lib"; +use lib "$FindBin::Bin/lib"; our $iters; @@ -43,7 +43,7 @@ EOF skip "Using remote server", 4; } - my $file = "$FindBin::Bin/../../../../01use.t"; + my $file = "$FindBin::Bin/01use.t"; my $fh = IO::File->new( $file, 'r' ); my $buffer; if ( defined $fh ) { diff --git a/t/live_engine_reponse_cookies.t b/t/live_engine_reponse_cookies.t index 0ed7e91..e87bb1d 100644 --- a/t/live_engine_reponse_cookies.t +++ b/t/live_engine_reponse_cookies.t @@ -4,7 +4,7 @@ use strict; use warnings; use FindBin; -use lib "$FindBin::Bin/../../lib"; +use lib "$FindBin::Bin/lib"; use Test::More tests => 10; use Catalyst::Test 'TestApp'; diff --git a/t/live_engine_reponse_errors.t b/t/live_engine_reponse_errors.t index 7a31ee9..7f7c366 100644 --- a/t/live_engine_reponse_errors.t +++ b/t/live_engine_reponse_errors.t @@ -4,7 +4,7 @@ use strict; use warnings; use FindBin; -use lib "$FindBin::Bin/../../lib"; +use lib "$FindBin::Bin/lib"; use Test::More tests => 18; use Catalyst::Test 'TestApp'; diff --git a/t/live_engine_reponse_headers.t b/t/live_engine_reponse_headers.t index fa22e73..1b374e4 100644 --- a/t/live_engine_reponse_headers.t +++ b/t/live_engine_reponse_headers.t @@ -4,7 +4,7 @@ use strict; use warnings; use FindBin; -use lib "$FindBin::Bin/../../lib"; +use lib "$FindBin::Bin/lib"; use Test::More tests => 18; use Catalyst::Test 'TestApp'; diff --git a/t/live_engine_reponse_large.t b/t/live_engine_reponse_large.t index 17a7cbe..0d24443 100644 --- a/t/live_engine_reponse_large.t +++ b/t/live_engine_reponse_large.t @@ -4,7 +4,7 @@ use strict; use warnings; use FindBin; -use lib "$FindBin::Bin/../../lib"; +use lib "$FindBin::Bin/lib"; use Test::More tests => 6; use Catalyst::Test 'TestApp'; diff --git a/t/live_engine_reponse_redirect.t b/t/live_engine_reponse_redirect.t index 6bc7089..3295779 100644 --- a/t/live_engine_reponse_redirect.t +++ b/t/live_engine_reponse_redirect.t @@ -4,7 +4,7 @@ use strict; use warnings; use FindBin; -use lib "$FindBin::Bin/../../lib"; +use lib "$FindBin::Bin/lib"; use Test::More tests => 20; use Catalyst::Test 'TestApp'; diff --git a/t/live_engine_reponse_status.t b/t/live_engine_reponse_status.t index 268e13a..51f6373 100644 --- a/t/live_engine_reponse_status.t +++ b/t/live_engine_reponse_status.t @@ -4,7 +4,7 @@ use strict; use warnings; use FindBin; -use lib "$FindBin::Bin/../../lib"; +use lib "$FindBin::Bin/lib"; use Test::More tests => 30; use Catalyst::Test 'TestApp'; diff --git a/t/live_engine_body.t b/t/live_engine_request_body.t similarity index 98% rename from t/live_engine_body.t rename to t/live_engine_request_body.t index d2551f1..06198f0 100644 --- a/t/live_engine_body.t +++ b/t/live_engine_request_body.t @@ -4,7 +4,7 @@ use strict; use warnings; use FindBin; -use lib "$FindBin::Bin/../../lib"; +use lib "$FindBin::Bin/lib"; use Test::More tests => 18; use Catalyst::Test 'TestApp'; diff --git a/t/live_engine_cookies.t b/t/live_engine_request_cookies.t similarity index 97% rename from t/live_engine_cookies.t rename to t/live_engine_request_cookies.t index 01faaac..5677b4e 100644 --- a/t/live_engine_cookies.t +++ b/t/live_engine_request_cookies.t @@ -4,7 +4,7 @@ use strict; use warnings; use FindBin; -use lib "$FindBin::Bin/../../lib"; +use lib "$FindBin::Bin/lib"; use Test::More tests => 13; use Catalyst::Test 'TestApp'; diff --git a/t/live_engine_headers.t b/t/live_engine_request_headers.t similarity index 98% rename from t/live_engine_headers.t rename to t/live_engine_request_headers.t index 86fe405..325e965 100644 --- a/t/live_engine_headers.t +++ b/t/live_engine_request_headers.t @@ -4,7 +4,7 @@ use strict; use warnings; use FindBin; -use lib "$FindBin::Bin/../../lib"; +use lib "$FindBin::Bin/lib"; use Test::More tests => 16; use Catalyst::Test 'TestApp'; diff --git a/t/live_engine_parameters.t b/t/live_engine_request_parameters.t similarity index 99% rename from t/live_engine_parameters.t rename to t/live_engine_request_parameters.t index f399b78..b0c8867 100644 --- a/t/live_engine_parameters.t +++ b/t/live_engine_request_parameters.t @@ -4,7 +4,7 @@ use strict; use warnings; use FindBin; -use lib "$FindBin::Bin/../../lib"; +use lib "$FindBin::Bin/lib"; use Test::More tests => 28; use Catalyst::Test 'TestApp'; diff --git a/t/live_engine_uploads.t b/t/live_engine_request_uploads.t similarity index 80% rename from t/live_engine_uploads.t rename to t/live_engine_request_uploads.t index 7b0f55f..48a215d 100644 --- a/t/live_engine_uploads.t +++ b/t/live_engine_request_uploads.t @@ -4,7 +4,7 @@ use strict; use warnings; use FindBin; -use lib "$FindBin::Bin/../../lib"; +use lib "$FindBin::Bin/lib"; use Test::More tests => 52; use Catalyst::Test 'TestApp'; @@ -22,9 +22,12 @@ use HTTP::Request::Common; 'http://localhost/dump/request/', 'Content-Type' => 'form-data', 'Content' => [ - 'cookies.t' => ["$FindBin::Bin/cookies.t"], - 'headers.t' => ["$FindBin::Bin/headers.t"], - 'uploads.t' => ["$FindBin::Bin/uploads.t"], + 'live_engine_request_cookies.t' => + ["$FindBin::Bin/live_engine_request_cookies.t"], + 'live_engine_request_headers.t' => + ["$FindBin::Bin/live_engine_request_headers.t"], + 'live_engine_request_uploads.t' => + ["$FindBin::Bin/live_engine_request_uploads.t"], ] ); @@ -63,11 +66,12 @@ use HTTP::Request::Common; is( $upload->type, $part->content_type, 'Upload Content-Type' ); is( $upload->size, length( $part->content ), 'Upload Content-Length' ); - + # make sure upload is accessible via legacy params->{$file} - is( $creq->{parameters}->{ $upload->filename }, $upload->filename, 'legacy param method ok' ); - - ok( ! -e $upload->tempname, 'Upload temp file was deleted' ); + is( $creq->{parameters}->{ $upload->filename }, + $upload->filename, 'legacy param method ok' ); + + ok( !-e $upload->tempname, 'Upload temp file was deleted' ); } } @@ -78,9 +82,9 @@ use HTTP::Request::Common; 'http://localhost/dump/request/', 'Content-Type' => 'multipart/form-data', 'Content' => [ - 'testfile' => ["$FindBin::Bin/cookies.t"], - 'testfile' => ["$FindBin::Bin/headers.t"], - 'testfile' => ["$FindBin::Bin/uploads.t"], + 'testfile' => ["$FindBin::Bin/live_engine_request_cookies.t"], + 'testfile' => ["$FindBin::Bin/live_engine_request_headers.t"], + 'testfile' => ["$FindBin::Bin/live_engine_request_uploads.t"], ] ); @@ -122,8 +126,8 @@ use HTTP::Request::Common; is( $upload->type, $part->content_type, 'Upload Content-Type' ); is( $upload->filename, $parameters{filename}, 'Upload filename' ); is( $upload->size, length( $part->content ), 'Upload Content-Length' ); - - ok( ! -e $upload->tempname, 'Upload temp file was deleted' ); + + ok( !-e $upload->tempname, 'Upload temp file was deleted' ); } } @@ -133,7 +137,8 @@ use HTTP::Request::Common; my $request = POST( 'http://localhost/engine/request/uploads/slurp', 'Content-Type' => 'multipart/form-data', - 'Content' => [ 'slurp' => ["$FindBin::Bin/uploads.t"], ] + 'Content' => + [ 'slurp' => ["$FindBin::Bin/live_engine_request_uploads.t"], ] ); ok( my $response = request($request), 'Request' ); diff --git a/t/live_engine_uri.t b/t/live_engine_request_uri.t similarity index 95% rename from t/live_engine_uri.t rename to t/live_engine_request_uri.t index b0a2f0a..5af97f9 100644 --- a/t/live_engine_uri.t +++ b/t/live_engine_request_uri.t @@ -4,7 +4,7 @@ use strict; use warnings; use FindBin; -use lib "$FindBin::Bin/../../lib"; +use lib "$FindBin::Bin/lib"; use Test::More tests => 23; use Catalyst::Test 'TestApp'; diff --git a/t/live_engine_setup_basics.t b/t/live_engine_setup_basics.t index 0bf2c9c..7d3d2d3 100644 --- a/t/live_engine_setup_basics.t +++ b/t/live_engine_setup_basics.t @@ -4,7 +4,7 @@ use strict; use warnings; use FindBin; -use lib "$FindBin::Bin/../../lib"; +use lib "$FindBin::Bin/lib"; use Test::More tests => 1; use Catalyst::Test 'TestApp'; diff --git a/t/live_engine_setup_plugins.t b/t/live_engine_setup_plugins.t index acf3092..d280551 100644 --- a/t/live_engine_setup_plugins.t +++ b/t/live_engine_setup_plugins.t @@ -4,7 +4,7 @@ use strict; use warnings; use FindBin; -use lib "$FindBin::Bin/../../lib"; +use lib "$FindBin::Bin/lib"; use Test::More tests => 2; use Catalyst::Test 'TestApp'; diff --git a/t/live_plugin_loaded.t b/t/live_plugin_loaded.t index 59c8823..57a1646 100644 --- a/t/live_plugin_loaded.t +++ b/t/live_plugin_loaded.t @@ -4,7 +4,7 @@ use strict; use warnings; use FindBin; -use lib "$FindBin::Bin/../lib"; +use lib "$FindBin::Bin/lib"; use Test::More tests => 5; use Catalyst::Test 'TestApp'; diff --git a/t/optinal_http-server-restart.t b/t/optional_http-server-restart.t similarity index 100% rename from t/optinal_http-server-restart.t rename to t/optional_http-server-restart.t diff --git a/t/optional_http-server.t b/t/optional_http-server.t index a518df0..d03a107 100644 --- a/t/optional_http-server.t +++ b/t/optional_http-server.t @@ -14,14 +14,14 @@ plan skip_all => 'File::Copy::Recursive required' if $@; plan tests => 1; # clean up -rmtree "$FindBin::Bin/../../t/tmp" if -d "$FindBin::Bin/../../t/tmp"; +rmtree "$FindBin::Bin/../t/tmp" if -d "$FindBin::Bin/../t/tmp"; # create a TestApp and copy the test libs into it -mkdir "$FindBin::Bin/../../t/tmp"; -chdir "$FindBin::Bin/../../t/tmp"; -system "perl -I$FindBin::Bin/../../lib $FindBin::Bin/../../script/catalyst.pl TestApp"; +mkdir "$FindBin::Bin/../t/tmp"; +chdir "$FindBin::Bin/../t/tmp"; +system "perl -I$FindBin::Bin/../lib $FindBin::Bin/../script/catalyst.pl TestApp"; chdir "$FindBin::Bin/../.."; -File::Copy::Recursive::dircopy( 't/live/lib', 't/tmp/TestApp/lib' ); +File::Copy::Recursive::dircopy( 't/lib', 't/tmp/TestApp/lib' ); # remove TestApp's tests rmtree 't/tmp/TestApp/t'; @@ -29,7 +29,7 @@ rmtree 't/tmp/TestApp/t'; # spawn the standalone HTTP server my $port = 30000 + int rand(1 + 10000); my $pid = open my $server, - "perl -I$FindBin::Bin/../../lib $FindBin::Bin/../../t/tmp/TestApp/script/testapp_server.pl -port $port 2>&1 |" + "perl -I$FindBin::Bin/../lib $FindBin::Bin/../t/tmp/TestApp/script/testapp_server.pl -port $port 2>&1 |" or die "Unable to spawn standalone HTTP server: $!"; # wait for it to start @@ -40,14 +40,14 @@ while ( check_port( 'localhost', $port ) != 1 ) { # run the testsuite against the HTTP server $ENV{CATALYST_SERVER} = "http://localhost:$port"; -system( 'prove -r -Ilib/ t/live/' ); +system( 'prove -r -Ilib/ t/live_*' ); # shut it down kill 'INT', $pid; close $server; # clean up -rmtree "$FindBin::Bin/../../t/tmp" if -d "$FindBin::Bin/../../t/tmp"; +rmtree "$FindBin::Bin/../t/tmp" if -d "$FindBin::Bin/../t/tmp"; ok( 'done' ); diff --git a/t/optional_memleak.t b/t/optional_memleak.t index 3dcfb06..bc5a5d4 100644 --- a/t/optional_memleak.t +++ b/t/optional_memleak.t @@ -4,7 +4,7 @@ use strict; use warnings; use FindBin; -use lib "$FindBin::Bin/../live/lib"; +use lib "$FindBin::Bin/lib"; use Test::More; use Catalyst::Test 'TestApp'; diff --git a/t/optional_stress.t b/t/optional_stress.t index d9fdf56..076c4f9 100644 --- a/t/optional_stress.t +++ b/t/optional_stress.t @@ -4,7 +4,7 @@ use strict; use warnings; use FindBin; -use lib "$FindBin::Bin/../live/lib"; +use lib "$FindBin::Bin/lib"; use Test::More; use Catalyst::Test 'TestApp'; diff --git a/t/optional_threads.t b/t/optional_threads.t index 82c748a..50a6ecd 100644 --- a/t/optional_threads.t +++ b/t/optional_threads.t @@ -4,7 +4,7 @@ use strict; use warnings; use FindBin; -use lib "$FindBin::Bin/../live/lib"; +use lib "$FindBin::Bin/lib"; use Test::More; use Catalyst::Test 'TestApp';