[Bps-public-commit] r17515 - Prophet/trunk/lib/Prophet/CLI/Command

jesse at bestpractical.com jesse at bestpractical.com
Thu Jan 1 21:17:46 EST 2009


Author: jesse
Date: Thu Jan  1 21:17:46 2009
New Revision: 17515

Modified:
   Prophet/trunk/lib/Prophet/CLI/Command/Export.pm

Log:
* Update the export command to take a currently undocumented flag to generate an atom feed



Modified: Prophet/trunk/lib/Prophet/CLI/Command/Export.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/CLI/Command/Export.pm	(original)
+++ Prophet/trunk/lib/Prophet/CLI/Command/Export.pm	Thu Jan  1 21:17:46 2009
@@ -4,8 +4,31 @@
 
 sub run {
     my $self = shift;
+    my $class;
 
-    $self->handle->export_to( path => $self->arg('path') );
+    unless ($self->context->has_arg('path')) {
+        die "You need to specify a --path argument to the 'export' command"."\n";
+    }
+
+    
+    warn $self->context->arg('format');
+    if ($self->context->has_arg('format') && ($self->context->arg('format') eq 'feed') ){
+        $class = 'Prophet::ReplicaFeedExporter';
+    } else {
+        $class = 'Prophet::ReplicaExporter';
+    }
+
+    $self->app_handle->require ($class);
+    warn "Running with class $class";
+
+    my $exporter = $class->new(
+        {   target_path    =>  $self->context->arg('path'),
+            source_replica => $self->app_handle->handle,
+            app_handle     => $self->app_handle
+        }
+    );
+
+    $exporter->export();
 }
 
 __PACKAGE__->meta->make_immutable;



More information about the Bps-public-commit mailing list