[Bps-public-commit] SD - A distributed issue tracker branch, master, updated. 875ed6c2092376cdc7169ad82ecbed3ae70d0969

spang at bestpractical.com spang at bestpractical.com
Tue Jan 20 15:37:42 EST 2009


The branch, master has been updated
       via  875ed6c2092376cdc7169ad82ecbed3ae70d0969 (commit)
       via  53101784b08344e047ad95b189ed3d0607ea2e90 (commit)
       via  0dcb3f925a8a9672f7cd4b107f31f9874f3ec8e7 (commit)
       via  d114cce6c06801ac263de76c514d5159b978e04a (commit)
      from  869366cf4bf6469b82ecf3ac822e44d1f0dfafbd (commit)

Summary of changes:
 lib/App/SD/CLI/Command/Help/Tickets.pm |    5 +
 lib/App/SD/CLI/Dispatcher.pm           |   16 +++
 t/sd-attachments.t                     |    2 +-
 t/sd-comments.t                        |    4 +-
 t/sd-dispatcher.t                      |  167 ++++++++++++++++++++++++++++++++
 t/sd-validation.t                      |    4 +-
 6 files changed, 193 insertions(+), 5 deletions(-)
 create mode 100644 t/sd-dispatcher.t

- Log -----------------------------------------------------------------
commit d114cce6c06801ac263de76c514d5159b978e04a
Author: Christine Spang <spang at bestpractical.com>
Date:   Tue Jan 20 21:28:08 2009 +0200

    simulate a 'claim' command by setting the owner prop and passing off to update

diff --git a/lib/App/SD/CLI/Dispatcher.pm b/lib/App/SD/CLI/Dispatcher.pm
index 0540eb7..ade18bb 100644
--- a/lib/App/SD/CLI/Dispatcher.pm
+++ b/lib/App/SD/CLI/Dispatcher.pm
@@ -61,6 +61,22 @@ under ticket => sub {
         run('ticket update', $self, @_);
     };
 
+    # simulate a 'claim' command by setting the owner prop and passing
+    # off to update
+    on [ [ 'claim', 'take' ] ] => sub {
+        my $self = shift;
+        my $email = $self->context->app_handle->config->get('email_address')
+                        || $ENV{EMAIL};
+
+        if ($email) {
+            $self->context->set_prop(owner => $email);
+            run('ticket update', $self, @_);
+        } else {
+            die "Could not determine email address to assign ticket to ".
+                "(set \$EMAIL\nor the 'email' config variable.)\n";
+        }
+    };
+
     under comment => sub {
         on [ [ 'new', 'create' ] ] => run_command('Ticket::Comment::Create');
         on [ [ 'update', 'edit' ] ] => run_command('Ticket::Comment::Update');

commit 0dcb3f925a8a9672f7cd4b107f31f9874f3ec8e7
Author: Christine Spang <spang at bestpractical.com>
Date:   Tue Jan 20 21:46:51 2009 +0200

    update tests for minor prophet output change

diff --git a/t/sd-attachments.t b/t/sd-attachments.t
index 1910456..e91b569 100644
--- a/t/sd-attachments.t
+++ b/t/sd-attachments.t
@@ -52,7 +52,7 @@ run_output_matches(
         '--',
         qw/--name/,                          "plague_recipe.doc"
     ],
-    [qr/attachment \d+ \($attachment_uuid\) updated/],
+    [qr/Attachment \d+ \($attachment_uuid\) updated/],
     [],
     "updated the attachment"
 );
diff --git a/t/sd-comments.t b/t/sd-comments.t
index a26e367..899c5cb 100644
--- a/t/sd-comments.t
+++ b/t/sd-comments.t
@@ -55,7 +55,7 @@ run_output_matches(
         '--',
         qw/--content/,                    "I hate you"
     ],
-    [qr/comment \d+ \($comment_uuid\) updated/],
+    [qr/Comment \d+ \($comment_uuid\) updated/],
     [],
     "updated the comment"
 );
@@ -88,7 +88,7 @@ run_output_matches(
         '--',
         qw/--content/,                    "A\nmultiline\ncomment"
     ],
-    [qr/comment \d+ \($comment_uuid\) updated/],
+    [qr/Comment \d+ \($comment_uuid\) updated/],
     [],
     "updated the comment to a multiline content"
 );
diff --git a/t/sd-validation.t b/t/sd-validation.t
index 72b57d5..b9df696 100644
--- a/t/sd-validation.t
+++ b/t/sd-validation.t
@@ -52,7 +52,7 @@ is_script_output( 'sd', [ 'ticket',
 is_script_output( 'sd', [ 'ticket',  
     'update', '--uuid', $yatta_uuid, '--', '--status', 'stalled'
     ],
-   [qr/ticket \d+ \($yatta_uuid\) updated./], # stdout
+   [qr/Ticket \d+ \($yatta_uuid\) updated./], # stdout
    [], # stderr
    "Setting the status to stalled went ok"
 
@@ -98,7 +98,7 @@ run_output_matches( 'sd', [ 'ticket',
 is_script_output( 'sd', [ 'ticket',  
     'update', '--uuid', $yatta_uuid, '--', '--status', 'super!'
     ],
-    [qr/ticket $yatta_id \($yatta_uuid\) updated/], #stdout
+    [qr/Ticket $yatta_id \($yatta_uuid\) updated/], #stdout
    [], # stderr
    "we can force-set an invalid prop"
 );

commit 53101784b08344e047ad95b189ed3d0607ea2e90
Author: Christine Spang <spang at bestpractical.com>
Date:   Tue Jan 20 22:31:58 2009 +0200

    tests for pseudo-commands in the dispatcher

diff --git a/t/sd-dispatcher.t b/t/sd-dispatcher.t
new file mode 100644
index 0000000..8135ceb
--- /dev/null
+++ b/t/sd-dispatcher.t
@@ -0,0 +1,167 @@
+#!/usr/bin/perl -w
+
+use strict;
+
+use Prophet::Test tests => 16;
+use App::SD::Test;
+no warnings 'once';
+
+BEGIN {
+    require File::Temp;
+    $ENV{'PROPHET_REPO'} = $ENV{'SD_REPO'} = File::Temp::tempdir( CLEANUP => 0 ) . '/_svb';
+    warn $ENV{'PROPHET_REPO'};
+}
+
+# tests for pseudo-commands that are only in the dispatcher
+
+run_script( 'sd', [ 'init']);
+
+# create from sd
+my ($yatta_id, $yatta_uuid) = create_ticket_ok(    '--summary', 'YATTA', '--status', 'new' );
+
+run_output_matches( 'sd', [ 'ticket',  
+    'list', '--regex', '.' ],
+    [  qr/(\d+) YATTA new/]
+);
+
+# test claim
+run_output_matches( 'sd', [ 'ticket', 'claim', $yatta_id ],
+    [ "Ticket $yatta_id ($yatta_uuid) updated." ]
+);
+
+run_output_matches( 'sd', [ 'ticket', 'basics', '--batch', '--id', $yatta_id ],
+    [
+        "id: $yatta_id ($yatta_uuid)",
+        'summary: YATTA',
+        'status: new',
+        'milestone: alpha',
+        'component: core',
+        'owner: ' . $ENV{EMAIL},
+        qr/^created: \d{4}-\d{2}-\d{2}.+$/,
+        qr/^creator: /,
+        'reporter: ' . $ENV{EMAIL},
+        "original_replica: " . replica_uuid,
+    ]
+);
+
+# revert back the change so we can check the alias for claim, take
+run_output_matches( 'sd', [ 'ticket', 'update', $yatta_id, '--', 'owner', '' ],
+    [ "Ticket $yatta_id ($yatta_uuid) updated." ]
+);
+
+run_output_matches( 'sd', [ 'ticket', 'basics', '--batch', '--id', $yatta_id ],
+    [
+        "id: $yatta_id ($yatta_uuid)",
+        'summary: YATTA',
+        'status: new',
+        'milestone: alpha',
+        'component: core',
+        qr/^created: \d{4}-\d{2}-\d{2}.+$/,
+        qr/^creator: /,
+        'reporter: ' . $ENV{EMAIL},
+        "original_replica: " . replica_uuid,
+    ]
+);
+
+# test take
+run_output_matches( 'sd', [ 'ticket', 'take', $yatta_id ],
+    [ "Ticket $yatta_id ($yatta_uuid) updated." ]
+);
+
+run_output_matches( 'sd', [ 'ticket', 'basics', '--batch', '--id', $yatta_id ],
+    [
+        "id: $yatta_id ($yatta_uuid)",
+        'summary: YATTA',
+        'status: new',
+        'milestone: alpha',
+        'component: core',
+        'owner: ' . $ENV{EMAIL},
+        qr/^created: \d{4}-\d{2}-\d{2}.+$/,
+        qr/^creator: /,
+        'reporter: ' . $ENV{EMAIL},
+        "original_replica: " . replica_uuid,
+    ]
+);
+
+# test resolve
+run_output_matches( 'sd', [ 'ticket', 'resolve', $yatta_id ],
+    [ "Ticket $yatta_id ($yatta_uuid) updated." ]
+);
+
+run_output_matches( 'sd', [ 'ticket', 'basics', '--batch', '--id', $yatta_id ],
+    [
+        "id: $yatta_id ($yatta_uuid)",
+        'summary: YATTA',
+        'status: closed',
+        'milestone: alpha',
+        'component: core',
+        'owner: ' . $ENV{EMAIL},
+        qr/^created: \d{4}-\d{2}-\d{2}.+$/,
+        qr/^creator: /,
+        'reporter: ' . $ENV{EMAIL},
+        "original_replica: " . replica_uuid,
+    ]
+);
+
+# revert that change so we can test resolve's alias, close
+run_output_matches( 'sd', [ 'ticket', 'update', $yatta_id, '--', 'status', 'new' ],
+    [ "Ticket $yatta_id ($yatta_uuid) updated." ]
+);
+
+run_output_matches( 'sd', [ 'ticket', 'basics', '--batch', '--id', $yatta_id ],
+    [
+        "id: $yatta_id ($yatta_uuid)",
+        'summary: YATTA',
+        'status: new',
+        'milestone: alpha',
+        'component: core',
+        'owner: ' . $ENV{EMAIL},
+        qr/^created: \d{4}-\d{2}-\d{2}.+$/,
+        qr/^creator: /,
+        'reporter: ' . $ENV{EMAIL},
+        "original_replica: " . replica_uuid,
+    ]
+);
+
+# test close
+run_output_matches( 'sd', [ 'ticket', 'close', $yatta_id ],
+    [ "Ticket $yatta_id ($yatta_uuid) updated." ]
+);
+
+run_output_matches( 'sd', [ 'ticket', 'basics', '--batch', '--id', $yatta_id ],
+    [
+        "id: $yatta_id ($yatta_uuid)",
+        'summary: YATTA',
+        'status: closed',
+        'milestone: alpha',
+        'component: core',
+        'owner: ' . $ENV{EMAIL},
+        qr/^created: \d{4}-\d{2}-\d{2}.+$/,
+        qr/^creator: /,
+        'reporter: ' . $ENV{EMAIL},
+        "original_replica: " . replica_uuid,
+    ]
+);
+
+TODO: {
+    local $TODO = "give interacts with the dispatcher in bad ways afaict";
+    # test give
+    run_output_matches( 'sd', [ 'ticket', 'give', $yatta_id, 'jesse at bestpractical.com' ],
+        [ "Ticket $yatta_id ($yatta_uuid) updated." ]
+    );
+
+    run_output_matches( 'sd', [ 'ticket', 'basics', '--batch', '--id', $yatta_id ],
+        [
+            "id: $yatta_id ($yatta_uuid)",
+            'summary: YATTA',
+            'status: new',
+            'milestone: alpha',
+            'component: core',
+            'owner: jesse at bestpractical.com',
+            qr/^created: \d{4}-\d{2}-\d{2}.+$/,
+            qr/^creator: /,
+            'reporter: ' . $ENV{EMAIL},
+            "original_replica: " . replica_uuid,
+        ]
+    );
+}

commit 875ed6c2092376cdc7169ad82ecbed3ae70d0969
Author: Christine Spang <spang at bestpractical.com>
Date:   Tue Jan 20 22:36:51 2009 +0200

    document take/claim

diff --git a/lib/App/SD/CLI/Command/Help/Tickets.pm b/lib/App/SD/CLI/Command/Help/Tickets.pm
index 3aa19d8..adc71a7 100644
--- a/lib/App/SD/CLI/Command/Help/Tickets.pm
+++ b/lib/App/SD/CLI/Command/Help/Tickets.pm
@@ -42,6 +42,11 @@ print <<EOF
       Sets the status of the ticket with uuid
       fad5849a-67f1-11dd-bde1-5b33d3ff2799 to closed.
 
+    $cmd ticket take 123
+      Sets the owner of ticket 123 to you (your email address is taken
+      from either the 'email_address' local config variable or the
+      EMAIL environmental variable). An alias of 'take' is 'claim'.
+
     $cmd ticket resolve 123
       Sets the status of the ticket with local id 123 to closed.
 

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



More information about the Bps-public-commit mailing list