[Bps-public-commit] Prophet branch, master, updated. 9b2440ab3165c32a1ea54f6ca722e76ebf4fe98a

jesse jesse at bestpractical.com
Tue Jun 9 10:14:48 EDT 2009


The branch, master has been updated
       via  9b2440ab3165c32a1ea54f6ca722e76ebf4fe98a (commit)
      from  d29000f6a86cd79c7a2f0ffd77553393376ae2ec (commit)

Summary of changes:
 lib/Prophet/App.pm               |   25 ++-----------------------
 lib/Prophet/CLI.pm               |    2 +-
 lib/Prophet/CLI/Command.pm       |    2 +-
 lib/Prophet/CLI/Command/Merge.pm |    2 +-
 lib/Prophet/Test/Participant.pm  |    2 +-
 5 files changed, 6 insertions(+), 27 deletions(-)

- Log -----------------------------------------------------------------
commit 9b2440ab3165c32a1ea54f6ca722e76ebf4fe98a
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Tue Jun 9 10:14:30 2009 -0400

    removed crazy old toplevel resdb_handle code

diff --git a/lib/Prophet/App.pm b/lib/Prophet/App.pm
index b696c85..9077d39 100644
--- a/lib/Prophet/App.pm
+++ b/lib/Prophet/App.pm
@@ -11,37 +11,16 @@ has handle => (
     default => sub {
         my $self = shift;
 
-        if ( ! $ENV{PROPHET_REPO}) { 
-            $ENV{'PROPHET_REPO'} = "file://".File::Spec->catdir($ENV{'HOME'}, '.prophet');
-
-        }
-        elsif   ($ENV{'PROPHET_REPO'} !~ /^[\w\+]+\:/ ) {
+        if   ($ENV{'PROPHET_REPO'} !~ /^[\w\+]+\:/ ) {
             my $path = $ENV{PROPHET_REPO};
             $path = File::Spec->rel2abs(glob($path)) unless File::Spec->file_name_is_absolute($path);
-            $ENV{PROPHET_REPO} = "file://$path";
+            $ENV{PROPHET_REPO} = $self->default_replica_type.":file://$path";
         }
 
         return Prophet::Replica->get_handle( url =>  $ENV{'PROPHET_REPO'}, app_handle => $self, );
     },
 );
 
-has resdb_handle => (
-    is      => 'rw',
-    isa     => 'Prophet::Replica',
-    lazy    => 1,
-    default => sub {
-        my $self = shift;
-        return $self->handle->resolution_db_handle
-            if $self->handle->resolution_db_handle;
-        my $root = ($ENV{'PROPHET_REPO'} || File::Spec->catdir($ENV{'HOME'}, '.prophet')) . "_res";
-        my $type = $self->default_replica_type;
-        my $r = Prophet::Replica->get_handle( url => $type.':file://' . $root );
-        if (!$r->replica_exists && $r->can_initialize) { $r->initialize}
-
-        return $r;
-    },
-);
-
 has config => (
     is      => 'rw',
     isa     => 'Prophet::Config',
diff --git a/lib/Prophet/CLI.pm b/lib/Prophet/CLI.pm
index 7e499a5..f06a0a2 100644
--- a/lib/Prophet/CLI.pm
+++ b/lib/Prophet/CLI.pm
@@ -26,7 +26,7 @@ has app_handle => (
     is      => 'rw',
     isa     => 'Prophet::App',
     lazy    => 1,
-    handles => [qw/handle resdb_handle config/],
+    handles => [qw/handle config/],
     default => sub {
         return $_[0]->app_class->new;
     },
diff --git a/lib/Prophet/CLI/Command.pm b/lib/Prophet/CLI/Command.pm
index 4866fd2..ee9a3f2 100644
--- a/lib/Prophet/CLI/Command.pm
+++ b/lib/Prophet/CLI/Command.pm
@@ -8,7 +8,7 @@ has cli => (
     isa => 'Prophet::CLI',
     weak_ref => 1,
     handles => [
-        qw/app_handle handle resdb_handle config/,
+        qw/app_handle handle config/,
     ],
 );
 
diff --git a/lib/Prophet/CLI/Command/Merge.pm b/lib/Prophet/CLI/Command/Merge.pm
index 8d949cd..552c29e 100644
--- a/lib/Prophet/CLI/Command/Merge.pm
+++ b/lib/Prophet/CLI/Command/Merge.pm
@@ -80,7 +80,7 @@ sub _do_merge {
     my $last_seen_from_source = $self->target->last_changeset_from_source( $self->source->uuid );
     my %import_args = (
         from  => $self->source,
-        resdb => $self->resdb_handle,
+        resdb => $self->app_handle->handle->resolution_db_handle,
         resolver_class => $self->merge_resolver(),
         force => $self->has_arg('force'),
     );
diff --git a/lib/Prophet/Test/Participant.pm b/lib/Prophet/Test/Participant.pm
index 887beb7..72d1ba4 100644
--- a/lib/Prophet/Test/Participant.pm
+++ b/lib/Prophet/Test/Participant.pm
@@ -140,7 +140,7 @@ sub dump_state {
 
     my $records  = Prophet::Collection->new( handle => $cli->handle, type => 'Scratch' );
     my $merges = Prophet::Collection->new( handle => $cli->handle, type => $Prophet::Replica::MERGETICKET_METATYPE );
-    my $resolutions = Prophet::Collection->new( handle => $cli->resdb_handle, type => '_prophet_resolution' );
+    my $resolutions = Prophet::Collection->new( handle => $cli->app_handle->handle->resolution_db_handle, type => '_prophet_resolution' );
 
     $records->matching( sub       {1} );
     $resolutions->matching( sub {1} );

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list