X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=script%2Fdbicadmin;h=e167ee4d1f210e77680e661bc77a37bcd5de11dd;hb=72933b1563291bf292106112ee991fb3581fe68a;hp=cc24560600a54427c7fdfe5ba1dc805f7d6e4016;hpb=099f10d17d95b08b12a9c88129c65b4bab0b60e2;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/script/dbicadmin b/script/dbicadmin index cc24560..e167ee4 100755 --- a/script/dbicadmin +++ b/script/dbicadmin @@ -1,4 +1,4 @@ -#!/usr/bin/perl +#!/usr/bin/env perl use strict; use warnings; @@ -44,14 +44,16 @@ my ($opts, $usage) = describe_options( ['op:s' => 'compatiblity option all of the above can be suppied as --op='], ['help' => 'display this help', { implies => { schema_class => '__dummy__' } } ], ['selfinject-pod' => 'hidden', { implies => { schema_class => '__dummy__' } } ], - ], required=> 1 }], + ], required => 1 }], ['Arguments'], + ["configuration" => hidden => { one_of => [ + ['config-file|config:s' => 'Supply the config file for parsing by Config::Any', { depends => 'config_stanza'} ], + ['connect-info:s%' => 'Supply the connect info as trailing options e.g. --connect-info dsn= user= password=' ], + ['connect:s' => 'Supply the connect info as a JSON-encoded structure, e.g. an --connect=["dsn","user","pass"]'], + ], required => 1 }], ['schema-class:s' => 'The class of the schema to load', { required => 1 } ], - ['resultset|resultset-class|class:s' => 'The resultset to operate on for data manipulation' ], ['config-stanza:s' => 'Where in the config to find the connection_info, supply in form MyApp::Model::DB',], - ['config:s' => 'Supply the config file for parsing by Config::Any', { depends => 'config_stanza'} ], - ['connect-info:s%' => 'Supply the connect info as additonal options ie -I dsn= user= password= '], - ['connect:s' => 'Supply the connect info as a json string' ], + ['resultset|resultset-class|class:s' => 'The resultset to operate on for data manipulation' ], ['sql-dir:s' => 'The directory where sql diffs will be created'], ['sql-type:s' => 'The RDBMs flavour you wish to use'], ['version:i' => 'Supply a version install'], @@ -66,8 +68,6 @@ my ($opts, $usage) = describe_options( ) ); -die "please only use one of --config or --connect-info\n" if ($opts->{config} and $opts->{connect_info}); - if($opts->{selfinject_pod}) { die "This is an internal method, do not call!!!\n" @@ -87,19 +87,22 @@ if($opts->{selfinject_pod}) { ); } -# FIXME - lowercasin will eventually go away when Getopt::Long::Descriptive is fixed +# FIXME - lowercasing will eventually go away when Getopt::Long::Descriptive is fixed if($opts->{i}) { - $opts->{include_dirs} = delete $opts->{i}; + require lib; + lib->import( @{delete $opts->{i}} ); } if($opts->{help}) { - $usage->die(); + $usage->die(); } # option compatability mangle +# (can not be joined in the spec, one is s% the other is s) if($opts->{connect}) { $opts->{connect_info} = delete $opts->{connect}; } + my $admin = DBIx::Class::Admin->new( %$opts ); my $action = $opts->{action};