[Bast-commits] r8391 - in
DBIx-Class/0.08/branches/dbicadmin_refactor: . lib/DBIx/Class
lib/DBIx/Class/Admin script
caelum at dev.catalyst.perl.org
caelum at dev.catalyst.perl.org
Wed Jan 20 19:54:31 GMT 2010
Author: caelum
Date: 2010-01-20 19:54:29 +0000 (Wed, 20 Jan 2010)
New Revision: 8391
Added:
DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Admin/
DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Admin/Types.pm
Modified:
DBIx-Class/0.08/branches/dbicadmin_refactor/Makefile.PL
DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Admin.pm
DBIx-Class/0.08/branches/dbicadmin_refactor/script/dbicadmin
Log:
minor fixups
Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/Makefile.PL
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/Makefile.PL 2010-01-20 15:31:41 UTC (rev 8390)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/Makefile.PL 2010-01-20 19:54:29 UTC (rev 8391)
@@ -59,7 +59,7 @@
'MooseX::Types::Path::Class' => '0.05',
'MooseX::Types::JSON' => '0.02',
'Try::Tiny' => '0.02',
- 'namespace::clean' => '0.11',
+ 'namespace::autoclean' => '0.09',
'parent' => '0.223',
'JSON::Any' => '0',
'Getopt::Long::Descriptive' => '0.081',
Added: DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Admin/Types.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Admin/Types.pm (rev 0)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Admin/Types.pm 2010-01-20 19:54:29 UTC (rev 8391)
@@ -0,0 +1,40 @@
+package # hide from PAUSE
+ DBIx::Class::Admin::Types;
+
+use MooseX::Types -declare => [qw(
+ DBICConnectInfo
+)];
+use MooseX::Types::Moose qw/Int HashRef ArrayRef Str Any Bool/;
+use MooseX::Types::JSON qw(JSON);
+
+coerce ArrayRef,
+ from JSON,
+ via { _json_to_data ($_) };
+
+coerce HashRef,
+ from JSON,
+ via { _json_to_data($_) };
+
+subtype DBICConnectInfo,
+ as ArrayRef;
+
+coerce DBICConnectInfo,
+ from JSON,
+ via { return _json_to_data($_) } ;
+
+coerce DBICConnectInfo,
+ from Str,
+ via { return _json_to_data($_) };
+
+coerce DBICConnectInfo,
+ from HashRef,
+ via { [ $_ ] };
+
+sub _json_to_data {
+ my ($json_str) = @_;
+ my $json = JSON::Any->new(allow_barekey => 1, allow_singlequote => 1, relaxed=>1);
+ my $ret = $json->jsonToObj($json_str);
+ return $ret;
+}
+
+1;
Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Admin.pm
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Admin.pm 2010-01-20 15:31:41 UTC (rev 8390)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/lib/DBIx/Class/Admin.pm 2010-01-20 19:54:29 UTC (rev 8391)
@@ -1,47 +1,39 @@
package DBIx::Class::Admin;
-use Moose;
-use MooseX::Types -declare => [qw( DBICConnectInfo )];
-use MooseX::Types::Moose qw/Int HashRef ArrayRef Str Any/;
-use MooseX::Types::JSON qw(JSON);
-use MooseX::Types::Path::Class qw(Dir File);
-use Try::Tiny;
+# check deps
+BEGIN {
+ my @_deps = qw(
+ Moose MooseX::Types MooseX::Types::JSON MooseX::Types::Path::Class
+ Try::Tiny parent JSON::Any Class::C3::Componentised
+ namespace::autoclean
+ );
-use Carp::Clan qw/^DBIx::Class/;
+ my @_missing_deps;
+ foreach my $dep (@_deps) {
+ eval "require $dep";
+ if ($@) {
+ push @_missing_deps, $dep;
+ }
+ }
-use parent 'Class::C3::Componentised';
+ if (@_missing_deps > 0) {
+ die "The following dependecies are missing " . join ",", @_missing_deps;
+ }
+}
+
+use Moose;
use parent 'DBIx::Class::Schema';
+use Carp::Clan qw/^DBIx::Class/;
+use MooseX::Types::Moose qw/Int HashRef ArrayRef Str Any Bool/;
+use DBIx::Class::Admin::Types qw/DBICConnectInfo/;
+use MooseX::Types::JSON qw(JSON);
+use MooseX::Types::Path::Class qw(Dir File);
+use Try::Tiny;
use JSON::Any;
-
use namespace::autoclean;
-my @_deps = qw(Moose MooseX::Types MooseX::Types::JSON MooseX::Types::Path::Class Try::Tiny parent JSON::Any Class::C3::Componentised namespace::autoclean);
-coerce ArrayRef,
- from JSON,
- via { _json_to_data ($_) };
-
-coerce HashRef,
- from JSON,
- via { _json_to_data($_) };
-
-subtype DBICConnectInfo,
- as ArrayRef;
-
-coerce DBICConnectInfo,
- from JSON,
- via { return _json_to_data($_) } ;
-
-coerce DBICConnectInfo,
- from Str,
- via { return _json_to_data($_) };
-
-coerce DBICConnectInfo,
- from HashRef,
- via { [ $_->{dsn}, $_->{user}, $_->{password} ] };
-
-
=head1 NAME
DBIx::Class::Admin - Administration object for schemas
@@ -79,7 +71,7 @@
has 'schema_class' => (
is => 'ro',
- isa => 'Str',
+ isa => Str,
coerce => 1,
);
@@ -199,7 +191,7 @@
has 'config_stanza' => (
is => 'ro',
- isa => 'Str',
+ isa => Str,
);
@@ -249,7 +241,7 @@
has version => (
is => 'rw',
- isa => 'Str',
+ isa => Str,
);
@@ -261,7 +253,7 @@
has preversion => (
is => 'rw',
- isa => 'Str',
+ isa => Str,
);
@@ -273,7 +265,7 @@
has force => (
is => 'rw',
- isa => 'Bool',
+ isa => Bool,
);
@@ -285,12 +277,12 @@
has quiet => (
is => 'rw',
- isa => 'Bool',
+ isa => Bool,
);
has '_confirm' => (
is => 'bare',
- isa => 'Bool',
+ isa => Bool,
);
@@ -563,32 +555,6 @@
return $cfg;
}
-sub _json_to_data {
- my ($json_str) = @_;
- my $json = JSON::Any->new(allow_barekey => 1, allow_singlequote => 1, relaxed=>1);
- my $ret = $json->jsonToObj($json_str);
- return $ret;
-}
-
-
-{ # deps check
-
-my @_missing_deps;
-foreach my $dep (@_deps) {
- eval "require $dep";
- if ($@) {
- push @_missing_deps, $dep;
- }
-}
-
-if (@_missing_deps > 0) {
- die "The following dependecies are missing " . join ",", @_missing_deps;
-}
-
-
-}
-
-
=head1 AUTHORS
See L<DBIx::Class/CONTRIBUTORS>.
Modified: DBIx-Class/0.08/branches/dbicadmin_refactor/script/dbicadmin
===================================================================
--- DBIx-Class/0.08/branches/dbicadmin_refactor/script/dbicadmin 2010-01-20 15:31:41 UTC (rev 8390)
+++ DBIx-Class/0.08/branches/dbicadmin_refactor/script/dbicadmin 2010-01-20 19:54:29 UTC (rev 8391)
@@ -14,7 +14,7 @@
['create|c' => 'Create version diffs needs preversion',],
['upgrade|u' => 'Upgrade the database to the current schema '],
['install|i' => 'Install the schema to the database',],
- ['deploy|d' => 'Deploy the a to the database',],
+ ['deploy|d' => 'Deploy the schema to the database',],
['select|s' => 'Select data from the schema', ],
['insert|i' => 'Insert data into the schema', ],
['update|u' => 'Update data in the schema', ],
More information about the Bast-commits
mailing list