[Bast-commits] r5887 - in branches/DBIx-Class-Schema-Loader/current:
lib/DBIx/Class/Schema lib/DBIx/Class/Schema/Loader t t/lib t/lib/My
arcanez at dev.catalyst.perl.org
arcanez at dev.catalyst.perl.org
Tue Apr 14 17:28:10 GMT 2009
Author: arcanez
Date: 2009-04-14 18:28:10 +0100 (Tue, 14 Apr 2009)
New Revision: 5887
Added:
branches/DBIx-Class-Schema-Loader/current/t/lib/My/
branches/DBIx-Class-Schema-Loader/current/t/lib/My/ResultBaseClass.pm
branches/DBIx-Class-Schema-Loader/current/t/lib/My/SchemaBaseClass.pm
Modified:
branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader.pm
branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/Base.pm
branches/DBIx-Class-Schema-Loader/current/t/23dumpmore.t
Log:
* use $^X instead of assuming /usr/bin/perl
* give ./script/dbicdump the same @INC as tests
* create My::ResultBaseClass and My::SchemaBaseClass for tests
* make result_base_class and schema_base_class valid options
* move the reading of custom content above the opening of the file for writing
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 2009-04-13 18:35:51 UTC (rev 5886)
+++ branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader/Base.pm 2009-04-14 17:28:10 UTC (rev 5887)
@@ -529,6 +529,11 @@
unlink($filename);
}
+ my $custom_content = $self->_get_custom_content($class, $filename);
+ $custom_content ||= qq|\n\n# You can replace this text with custom|
+ . qq| content, and it will be preserved on regeneration|
+ . qq|\n1;\n|;
+
$text .= qq|$_\n|
for @{$self->{_dump_storage}->{$class} || []};
@@ -548,12 +553,6 @@
for @{$self->{_ext_storage}->{$class} || []};
# Write out any custom content the user has added
- my $custom_content = $self->_get_custom_content($class, $filename);
-
- $custom_content ||= qq|\n\n# You can replace this text with custom|
- . qq| content, and it will be preserved on regeneration|
- . qq|\n1;\n|;
-
print $fh $custom_content;
close($fh)
Modified: branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader.pm
===================================================================
--- branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader.pm 2009-04-13 18:35:51 UTC (rev 5886)
+++ branches/DBIx-Class-Schema-Loader/current/lib/DBIx/Class/Schema/Loader.pm 2009-04-14 17:28:10 UTC (rev 5887)
@@ -168,7 +168,7 @@
my $self = shift;
if($_[-1] && ref $_[-1] eq 'HASH') {
- for my $option (qw/ loader_class loader_options /) {
+ for my $option (qw/ loader_class loader_options result_base_class schema_base_class/) {
if(my $value = delete $_[-1]->{$option}) {
$self->$option($value);
}
Modified: branches/DBIx-Class-Schema-Loader/current/t/23dumpmore.t
===================================================================
--- branches/DBIx-Class-Schema-Loader/current/t/23dumpmore.t 2009-04-13 18:35:51 UTC (rev 5886)
+++ branches/DBIx-Class-Schema-Loader/current/t/23dumpmore.t 2009-04-14 17:28:10 UTC (rev 5887)
@@ -8,7 +8,7 @@
$^O eq 'MSWin32'
? plan(skip_all => "ActiveState perl produces additional warnings, and this test uses unix paths")
- : plan(tests => 143);
+ : plan(tests => 145);
my $DUMP_PATH = './t/_dump';
@@ -38,7 +38,8 @@
sub dump_dbicdump {
my %tdata = @_;
- my @cmd = qw(./script/dbicdump);
+ # use $^X so we execute ./script/dbicdump with the same perl binary that the tests were executed with
+ my @cmd = ($^X, qw(./script/dbicdump));
while (my ($opt, $val) = each(%{ $tdata{options} })) {
push @cmd, '-o', "$opt=$val";
@@ -46,6 +47,9 @@
push @cmd, $tdata{classname}, $make_dbictest_db::dsn;
+ # make sure our current @INC gets used by dbicdump
+ local $ENV{PERL5LIB} = join ":", @INC, $ENV{PERL5LIB};
+
my ($in, $out, $err);
my $pid = open3($in, $out, $err, @cmd);
Added: branches/DBIx-Class-Schema-Loader/current/t/lib/My/ResultBaseClass.pm
===================================================================
--- branches/DBIx-Class-Schema-Loader/current/t/lib/My/ResultBaseClass.pm (rev 0)
+++ branches/DBIx-Class-Schema-Loader/current/t/lib/My/ResultBaseClass.pm 2009-04-14 17:28:10 UTC (rev 5887)
@@ -0,0 +1,3 @@
+package My::ResultBaseClass;
+use base 'DBIx::Class';
+1;
Added: branches/DBIx-Class-Schema-Loader/current/t/lib/My/SchemaBaseClass.pm
===================================================================
--- branches/DBIx-Class-Schema-Loader/current/t/lib/My/SchemaBaseClass.pm (rev 0)
+++ branches/DBIx-Class-Schema-Loader/current/t/lib/My/SchemaBaseClass.pm 2009-04-14 17:28:10 UTC (rev 5887)
@@ -0,0 +1,3 @@
+package My::SchemaBaseClass;
+use base 'DBIx::Class::Schema';
+1;
More information about the Bast-commits
mailing list