[Bps-public-commit] r11582 - in SVN-PropDB: .

jesse at bestpractical.com jesse at bestpractical.com
Sun Apr 6 05:54:10 EDT 2008


Author: jesse
Date: Sun Apr  6 05:54:09 2008
New Revision: 11582

Modified:
   SVN-PropDB/   (props changed)
   SVN-PropDB/lib/Prophet/CLI.pm
   SVN-PropDB/lib/Prophet/Replica.pm

Log:
 r29366 at 68-247-97-201:  jesse | 2008-04-05 23:51:21 -1000
 * stub export replica format


Modified: SVN-PropDB/lib/Prophet/CLI.pm
==============================================================================
--- SVN-PropDB/lib/Prophet/CLI.pm	(original)
+++ SVN-PropDB/lib/Prophet/CLI.pm	Sun Apr  6 05:54:09 2008
@@ -257,6 +257,7 @@
 
 }
 
+
 sub do_push {
     my $self = shift;
     my $source_me = Prophet::Replica->new( { url => "file://".$self->handle->repo_path } );
@@ -267,6 +268,13 @@
     $self->_do_merge( $source_me, $source_other );
 }
 
+sub do_export {
+    my $self = shift;
+    my $source_me = Prophet::Replica->new( { url => "file://".$self->handle->repo_path } );
+    my $path = $self->args->{'path'};
+    $source_me->export_to($path);
+}
+
 sub do_pull {
     my $self = shift;
     my $source_me = Prophet::Replica->new( { url => "file://".$self->handle->repo_path } );

Modified: SVN-PropDB/lib/Prophet/Replica.pm
==============================================================================
--- SVN-PropDB/lib/Prophet/Replica.pm	(original)
+++ SVN-PropDB/lib/Prophet/Replica.pm	Sun Apr  6 05:54:09 2008
@@ -416,6 +416,48 @@
     return \@results;
 }
 
+use Path::Class;
+use Digest::SHA1 qw(sha1);
+
+sub export_to {
+    my $self = shift;
+    my $path = shift;
+
+     my $replica_root=   dir($path, $self->db_uuid);
+
+    _mkdir($path);
+    _mkdir($replica_root);
+    my $uuid_file = file($replica_root => $self->uuid);
+    `touch $uuid_file`; 
+    mkdir(dir($replica_root => 'content'));    
+    mkdir(dir($replica_root => 'content' => 'some_record_type'));    
+    mkdir(dir($replica_root => 'cas'));
+    for my $a (0..9, 'a'..'f') {
+        mkdir(dir($replica_root => 'cas' => $a));
+        for my $b (0..9, 'a'..'f') {
+        mkdir(dir($replica_root => 'cas' => $a => $b));
+        }
+    }
+    open(my $changesets, ">" . file($replica_root, 'changesets.idx')) || die $!;
+    print $changesets " 1 : ". Data::UUID->new->create_str(). " : 2 : ".sha1('flying man') ."\n" || die $!;
+
+    close ($changesets); 
+}
+
+
+sub _mkdir {
+    my $path = shift;
+    unless (-d $path) {
+        mkdir ($path) || die $@;
+    }
+    unless (-w $path) {
+        die "$path not writable";
+    }
+
+
+}
+
+
     
 sub serialize_changeset {
     my $self = shift;



More information about the Bps-public-commit mailing list