[Bps-public-commit] r11659 - in Prophet/trunk: .
jesse at bestpractical.com
jesse at bestpractical.com
Tue Apr 8 22:58:48 EDT 2008
Author: jesse
Date: Tue Apr 8 22:58:47 2008
New Revision: 11659
Modified:
Prophet/trunk/ (props changed)
Prophet/trunk/lib/Prophet/CLI.pm
Log:
r29541 at 31b: jesse | 2008-04-08 22:58:41 -0400
* bits of the cli code needed for the most recently pushed sd code
Modified: Prophet/trunk/lib/Prophet/CLI.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/CLI.pm (original)
+++ Prophet/trunk/lib/Prophet/CLI.pm Tue Apr 8 22:58:47 2008
@@ -3,7 +3,7 @@
package Prophet::CLI;
use base qw/Class::Accessor/;
-__PACKAGE__->mk_accessors(qw/record_class type uuid _handle _resdb_handle/);
+__PACKAGE__->mk_accessors(qw/app_class record_class type uuid _handle _resdb_handle/);
use Path::Class;
use Prophet;
@@ -16,6 +16,14 @@
my $class = shift;
my $self = $class->SUPER::new(@_);
$self->record_class('Prophet::Record') unless $self->record_class;
+
+ if($self->app_class) {
+ my $replica_class = $self->app_class."::Replica";
+ my $except = $replica_class."::(.*)::";
+ Module::Pluggable->import( search_path => $replica_class, sub_name => 'app_replica_types', require => 1, except => qr/$except/);
+ Prophet::Replica->register_replica_scheme(scheme => $_->scheme, class => $_) for ( __PACKAGE__->app_replica_types);
+ }
+
# Initialize our handle and resolution db handle
@@ -94,6 +102,7 @@
my $cmd = shift @ARGV or die "record subcommand required";
$cmd =~ s/^--//g;
+ $record_class->require || die $@;
if ( $record_class->REFERENCES->{$cmd} ) {
return $self->_handle_reference_command( $record_class, $record_class->REFERENCES->{$cmd} );
}
@@ -124,6 +133,7 @@
for my $type (@types) {
no strict 'refs';
my $class = $model_base . '::' . ucfirst($type);
+ $class->require;
*{ $calling_package . "::cmd_" . $type } = sub {
$self->_record_cmd( $type => $class );
};
@@ -209,6 +219,7 @@
die "Specify a regular expression and we'll search for records matching that regex";
}
my $record = $self->_get_record;
+ $record->collection_class->require;
my $records = $record->collection_class->new( handle => $self->handle, type => $self->type );
$records->matching(
sub {
More information about the Bps-public-commit
mailing list