[Jifty-commit] jifty branch, master, updated. a4d0934544010770537007695ff9f5d853d1361e

Jifty commits jifty-commit at lists.jifty.org
Wed Feb 24 01:41:02 EST 2010


The branch, master has been updated
       via  a4d0934544010770537007695ff9f5d853d1361e (commit)
      from  45f0334b849c1fbbd6dde87cfe0369a32758e86f (commit)

Summary of changes:
 lib/Jifty/Test.pm |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

- Log -----------------------------------------------------------------
commit a4d0934544010770537007695ff9f5d853d1361e
Author: Chia-liang Kao <clkao at clkao.org>
Date:   Wed Feb 24 13:02:31 2010 +0800

    detect configfileversion and default jifty_test_server to Standalone for older apps.

diff --git a/lib/Jifty/Test.pm b/lib/Jifty/Test.pm
index 0f13c71..0a681c7 100644
--- a/lib/Jifty/Test.pm
+++ b/lib/Jifty/Test.pm
@@ -195,6 +195,17 @@ sub setup {
     $args ||= [];
     my %args = @{$args} % 2 ? (@{$args}, 1) : @{$args};
 
+    my $root = Jifty::Util->app_root;
+
+    require Jifty::YAML;
+    # naive detect of configfileversion before jifty->new, since you
+    # probably don't want to override it in site_config or other places.
+    my $config = eval { Jifty::YAML::LoadFile("$root/etc/config.yml") };
+    if ($config && $config->{framework}{ConfigFileVersion} &&
+                   $config->{framework}{ConfigFileVersion} < 5) {
+        $ENV{JIFTY_TEST_SERVER} ||= 'Standalone';
+    }
+
     my $server = $ENV{JIFTY_TEST_SERVER} ||= 'Inline';
 
     if ($server eq 'Inline') {
@@ -216,7 +227,6 @@ sub setup {
     }
 
     # Require the things we need
-    require Jifty::YAML;
     require Jifty::Script::Schema;
 
     $class->builder->{no_handle} = $args{no_handle};
@@ -246,8 +256,6 @@ sub setup {
       }
         
     }
-    my $root = Jifty::Util->app_root;
-
     # Mason's disk caching sometimes causes false tests
     rmtree([ File::Spec->canonpath("$root/var/mason") ], 0, 1);
 

-----------------------------------------------------------------------


More information about the Jifty-commit mailing list