[Catalyst-commits] r12277 - in Catalyst-Runtime/5.80/trunk: lib/Catalyst/Script t/aggregate

t0m at dev.catalyst.perl.org t0m at dev.catalyst.perl.org
Wed Dec 9 20:35:13 GMT 2009


Author: t0m
Date: 2009-12-09 20:35:13 +0000 (Wed, 09 Dec 2009)
New Revision: 12277

Modified:
   Catalyst-Runtime/5.80/trunk/lib/Catalyst/Script/Server.pm
   Catalyst-Runtime/5.80/trunk/t/aggregate/unit_core_script_server.t
Log:
And more tests and fixing for the same thing

Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/Script/Server.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/Script/Server.pm	2009-12-09 20:21:13 UTC (rev 12276)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/Script/Server.pm	2009-12-09 20:35:13 UTC (rev 12277)
@@ -47,8 +47,7 @@
     isa           => PositiveInt,
     is            => 'ro',
     default       => sub {
-        my $self = shift;
-        $ENV{ Catalyst::Utils::class2env($self->application_name . '_PORT')}||3000
+        Catalyst::Utils::env_value(shift->application_name, 'port') || 3000
     },
     documentation => 'Specify a different listening port (to the default port 3000)',
 );
@@ -84,7 +83,9 @@
     cmd_aliases   => 'r',
     isa           => Bool,
     is            => 'ro',
-    default       => 0,
+    default       => sub {
+        Catalyst::Utils::env_value(shift->application_name, 'reload') || 0;
+    },
     documentation => 'use Catalyst::Restarter to detect code changes and restart the application',
 );
 

Modified: Catalyst-Runtime/5.80/trunk/t/aggregate/unit_core_script_server.t
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/aggregate/unit_core_script_server.t	2009-12-09 20:21:13 UTC (rev 12276)
+++ Catalyst-Runtime/5.80/trunk/t/aggregate/unit_core_script_server.t	2009-12-09 20:35:13 UTC (rev 12277)
@@ -30,6 +30,10 @@
     local $ENV{TESTAPPTOTESTSCRIPTS_PORT} = 5000;
     testOption( [ qw// ], [5000, undef, opthash()] );
 }
+{
+    local $ENV{CATALYST_PORT} = 5000;
+    testOption( [ qw// ], [5000, undef, opthash()] );
+}
 
 # fork           -f -fork --fork           -f --fork
 testOption( [ qw/--fork/ ], ['3000', undef, opthash(fork => 1)] );
@@ -53,6 +57,15 @@
 
 # restart        -r -restart --restart     -R --restart
 testRestart( ['-r'], restartopthash() );
+{
+    local $ENV{TESTAPPTOTESTSCRIPTS_RELOAD} = 1;
+    testRestart( [], restartopthash() );
+}
+{
+    local $ENV{CATALYST_RELOAD} = 1;
+    testRestart( [], restartopthash() );
+}
+
 # restart dly    -rd -restartdelay         --rd --restart_delay
 testRestart( ['-r', '--rd', 30], restartopthash(sleep_interval => 30) );
 testRestart( ['-r', '--restart_delay', 30], restartopthash(sleep_interval => 30) );
@@ -82,6 +95,7 @@
 sub testRestart {
     my ($argstring, $resultarray) = @_;
     my $app = _build_testapp($argstring);
+    ok $app->restart, 'App is in restart mode';
     my $args = {$app->_restarter_args};
     is_deeply delete $args->{argv}, $argstring, 'argv is arg string';
     is ref(delete $args->{start_sub}), 'CODE', 'Closure to start app present';




More information about the Catalyst-commits mailing list