[Bast-commits] r9334 - in
DBIx-Class/0.08/branches/dbicadmin-non-versioned:
lib/DBIx/Class script
edenc at dev.catalyst.perl.org
edenc at dev.catalyst.perl.org
Fri May 7 22:02:41 GMT 2010
Author: edenc
Date: 2010-05-07 23:02:41 +0100 (Fri, 07 May 2010)
New Revision: 9334
Modified:
DBIx-Class/0.08/branches/dbicadmin-non-versioned/lib/DBIx/Class/Admin.pm
DBIx-Class/0.08/branches/dbicadmin-non-versioned/script/dbicadmin
Log:
-I option functional and passing tests
Modified: DBIx-Class/0.08/branches/dbicadmin-non-versioned/lib/DBIx/Class/Admin.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin-non-versioned/lib/DBIx/Class/Admin.pm 2010-05-07 22:02:25 UTC (rev 9333)
+++ DBIx-Class/0.08/branches/dbicadmin-non-versioned/lib/DBIx/Class/Admin.pm 2010-05-07 22:02:41 UTC (rev 9334)
@@ -88,13 +88,26 @@
sub _build_schema {
my ($self) = @_;
require Class::MOP;
- Class::MOP::load_class($self->schema_class);
-
+ {
+ local @INC = (@{$self->include_dirs}, @INC);
+ Class::MOP::load_class($self->schema_class);
+ }
$self->connect_info->[3]->{ignore_version} =1;
return $self->schema_class->connect(@{$self->connect_info()} ); # , $self->connect_info->[3], { ignore_version => 1} );
}
+=head2 include_dirs
+Extra include directories to look when loading C<schema_class>
+
+=cut
+
+has 'include_dirs' => (
+ is => 'rw',
+ isa => 'ArrayRef',
+ default => sub {[]}
+);
+
=head2 resultset
a resultset from the schema to operate on
Modified: DBIx-Class/0.08/branches/dbicadmin-non-versioned/script/dbicadmin
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin-non-versioned/script/dbicadmin 2010-05-07 22:02:25 UTC (rev 9333)
+++ DBIx-Class/0.08/branches/dbicadmin-non-versioned/script/dbicadmin 2010-05-07 22:02:41 UTC (rev 9334)
@@ -39,7 +39,7 @@
['deploy' => 'Deploy the schema to the database',],
['select' => 'Select data from the schema', ],
['insert' => 'Insert data into the schema', ],
- ['update' => 'Update data in the schema', ],
+ ['update' => 'Update data in the schema', ],
['delete' => 'Delete data from the schema',],
['op:s' => 'compatiblity option all of the above can be suppied as --op=<action>'],
['help' => 'display this help', { implies => { schema_class => '__dummy__' } } ],
@@ -62,6 +62,7 @@
['force' => 'Be forceful with some operations'],
['trace' => 'Turn on DBIx::Class trace output'],
['quiet' => 'Be less verbose'],
+ ['I:s@' => 'Same as perl\'s -I']
)
);
@@ -86,6 +87,10 @@
);
}
+if($opts->{I}) {
+ $opts->{include} = delete $opts->{I};
+}
+
if($opts->{help}) {
$usage->die();
}
@@ -102,7 +107,7 @@
$action = $opts->{op} if ($action eq 'op');
-print "Performig action $action...\n";
+print "Performing action $action...\n";
my $res = $admin->$action();
if ($action eq 'select') {
More information about the Bast-commits
mailing list