[Bast-commits] r8302 - in branches/DBIx-Class-Schema-Loader/current: lib/DBIx/Class/Schema/Loader t

caelum at dev.catalyst.perl.org caelum at dev.catalyst.perl.org
Thu Jan 14 03:02:44 GMT 2010


Author: caelum
Date: 2010-01-14 03:02:44 +0000 (Thu, 14 Jan 2010)
New Revision: 8302

Modified:
   branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/Base.pm
   branches/DBIx-Class-Schema-Loader/current/t/25backcompat_v4.t
Log:
fix for deleting empty Result dir when rewriting result_namespace or downgrading to load_classes

Modified: branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/Base.pm
===================================================================
--- branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/Base.pm	2010-01-13 21:33:41 UTC (rev 8301)
+++ branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/Base.pm	2010-01-14 03:02:44 UTC (rev 8302)
@@ -958,7 +958,8 @@
 
     # remove Result dir if downgrading from use_namespaces, and there are no
     # files left.
-    if (my $result_ns = $self->_downgrading_to_load_classes) {
+    if (my $result_ns = $self->_downgrading_to_load_classes
+                        || $self->_rewriting_result_namespace) {
         my $result_namespace = $self->_result_namespace(
             $schema_class,
             $result_ns,

Modified: branches/DBIx-Class-Schema-Loader/current/t/25backcompat_v4.t
===================================================================
--- branches/DBIx-Class-Schema-Loader/current/t/25backcompat_v4.t	2010-01-13 21:33:41 UTC (rev 8301)
+++ branches/DBIx-Class-Schema-Loader/current/t/25backcompat_v4.t	2010-01-14 03:02:44 UTC (rev 8302)
@@ -866,13 +866,14 @@
     is $res->{classes}{quuxs}, 'DBIXCSL_Test::Schema::MyResult::Quux',
         'using new result_namespace';
 
+    (my $schema_dir = "$DUMP_DIR/$SCHEMA_CLASS")          =~ s{::}{/}g;
     (my $result_dir = "$DUMP_DIR/$SCHEMA_CLASS/MyResult") =~ s{::}{/}g;
     my $result_count =()= glob "$result_dir/*";
 
     is $result_count, 4,
 'correct number of Results after rewritten result_namespace';
 
-    ok ((not -d "$result_dir/Result"),
+    ok ((not -d "$schema_dir/Result"),
         'original Result dir was removed when rewriting result_namespace');
 
     # check that custom content was preserved
@@ -900,13 +901,14 @@
     is $res->{classes}{quuxs}, 'DBIXCSL_Test::Schema::Mtfnpy::Quux',
         'using new result_namespace';
 
+    ($schema_dir = "$DUMP_DIR/$SCHEMA_CLASS")        =~ s{::}{/}g;
     ($result_dir = "$DUMP_DIR/$SCHEMA_CLASS/Mtfnpy") =~ s{::}{/}g;
     $result_count =()= glob "$result_dir/*";
 
     is $result_count, 4,
 'correct number of Results after rewritten result_namespace';
 
-    ok ((not -d "$result_dir/MyResult"),
+    ok ((not -d "$schema_dir/MyResult"),
         'original Result dir was removed when rewriting result_namespace');
 
     # check that custom content was preserved




More information about the Bast-commits mailing list