[Bps-public-commit] Prophet branch, master, updated. 0.73-18-gd5da481

jesse jesse at bestpractical.com
Fri Nov 27 13:04:52 EST 2009


The branch, master has been updated
       via  d5da4817056a2fb4103c124f76309ed55a3f1730 (commit)
      from  0d587aa1378090b5039124bbbb370873972f2d82 (commit)

Summary of changes:
 lib/Prophet/CLI/Command/Clone.pm |    9 ++++++---
 t/database-settings.t            |    5 +++--
 t/usage.t                        |    2 +-
 3 files changed, 10 insertions(+), 6 deletions(-)

- Log -----------------------------------------------------------------
commit d5da4817056a2fb4103c124f76309ed55a3f1730
Author: franck cuny <franck at lumberjaph.net>
Date:   Thu Nov 19 18:11:49 2009 +0100

    add --as <alias> to clone

diff --git a/lib/Prophet/CLI/Command/Clone.pm b/lib/Prophet/CLI/Command/Clone.pm
index b17490f..97e56ae 100644
--- a/lib/Prophet/CLI/Command/Clone.pm
+++ b/lib/Prophet/CLI/Command/Clone.pm
@@ -7,7 +7,7 @@ sub usage_msg {
     my $cmd = $self->cli->get_script_name;
 
     return <<"END_USAGE";
-usage: ${cmd}clone --from <url> | --local
+usage: ${cmd}clone --from <url> [--as <alias>]| --local
 END_USAGE
 }
 
@@ -61,13 +61,16 @@ sub run {
 
     # create new config section for this replica
     my $from = $self->arg('from');
+    my $alias = $self->arg('as');
+    my $base_key = $alias ? 'replica.'.$alias : 'replica.'.$from;
+
     $self->app_handle->config->group_set(
         $self->app_handle->config->replica_config_file,
         [ {
-            key => 'replica.'.$from.'.url',
+            key => $base_key.'.url',
             value => $self->arg('from'),
         },
-        {   key => 'replica.'.$from.'.uuid',
+        {   key => $base_key.'.uuid',
             value => $self->target->uuid,
         },
         ]
diff --git a/t/database-settings.t b/t/database-settings.t
index fa2c3bb..3135f24 100644
--- a/t/database-settings.t
+++ b/t/database-settings.t
@@ -91,7 +91,7 @@ as_bob {
     isa_ok( $cxn, 'Prophet::Replica', "Got the cxn " . $cxn->fs_root );
 
     # pull from alice
-    run_ok( 'prophet', ['clone', '--from', "file://".$alice_cli->app_handle->handle->fs_root] );
+    run_ok( 'prophet', ['clone', '--from', "file://".$alice_cli->app_handle->handle->fs_root, '--as', 'alice'] );
     run_ok( 'prophet', [qw(create --type Bug -- --status open --from bob )], "Created a record as bob" );
     run_output_matches( 'prophet', [qw(search --type Bug --regex open)], [qr/open/], [], "Found our record" );
 
@@ -138,7 +138,8 @@ as_bob {
 as_bob {
 
     #   pull from alice
-    run_ok( 'prophet', ['pull', '--from', "file://".$alice_cli->app_handle->handle->fs_root, '--force', '--prefer', 'to'] );
+    #run_ok( 'prophet', ['pull', '--from', "file://".$alice_cli->app_handle->handle->fs_root, '--force', '--prefer', 'to'] );
+    run_ok( 'prophet', ['pull', '--from', 'alice', '--force', '--prefer', 'to'] );
     # enumerate statuses
     my $t = MyApp::Model::Task->new(handle => $bob_cli->app_handle->handle);
     TODO: { 
diff --git a/t/usage.t b/t/usage.t
index d1b3ebe..6eabd95 100644
--- a/t/usage.t
+++ b/t/usage.t
@@ -56,7 +56,7 @@ my @cmds = (
     },
     {
         cmd     => [ 'clone', '-h' ],
-        error   => [ 'usage: usage.t clone --from <url> | --local' ],
+        error   => [ 'usage: usage.t clone --from <url> [--as <alias>]| --local' ],
         comment => 'clone usage',
     },
     {

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



More information about the Bps-public-commit mailing list