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

spang at bestpractical.com spang at bestpractical.com
Wed Jan 28 10:27:52 EST 2009


The branch, master has been updated
       via  9936b0f26b29240c32733f42f2e68510b44e5d52 (commit)
       via  e66ad0972f1717cf144ccfc039afc4ed15601f39 (commit)
      from  4ae79476683505a30b127ec037a4337c5491c4f6 (commit)

Summary of changes:
 lib/App/SD/CLI/Command/Help/Config.pm |    2 +-
 lib/App/SD/CLI/Command/Help/Search.pm |    2 +-
 lib/App/SD/CLI/Command/Ticket/Show.pm |    4 +-
 lib/App/SD/CLI/Dispatcher.pm          |   19 +++++++---
 t/06-ticket-show.t                    |    6 ++--
 t/sd-dispatcher.t                     |   65 +++++++++++++++++++++------------
 6 files changed, 62 insertions(+), 36 deletions(-)

- Log -----------------------------------------------------------------
commit e66ad0972f1717cf144ccfc039afc4ed15601f39
Author: Christine Spang <spang at bestpractical.com>
Date:   Wed Jan 28 13:14:21 2009 +0200

    with-history makes more sense and I always type it rather than show-history

diff --git a/lib/App/SD/CLI/Command/Help/Config.pm b/lib/App/SD/CLI/Command/Help/Config.pm
index c48053e..c6b77c7 100644
--- a/lib/App/SD/CLI/Command/Help/Config.pm
+++ b/lib/App/SD/CLI/Command/Help/Config.pm
@@ -33,7 +33,7 @@ Currently, the following configuration variables are available:
 
     disable_ticket_show_history_by_default = 1
       Don't display ticket history when running '$cmd ticket show'. Can
-      be overridden by passing the '--show-history' arg to the
+      be overridden by passing the '--with-history' arg to the
       command.
 
     common_ticket_props = id,summary,status,owner,created,original_replica
diff --git a/lib/App/SD/CLI/Command/Help/Search.pm b/lib/App/SD/CLI/Command/Help/Search.pm
index d79685d..0ab6e28 100644
--- a/lib/App/SD/CLI/Command/Help/Search.pm
+++ b/lib/App/SD/CLI/Command/Help/Search.pm
@@ -41,7 +41,7 @@ print <<EOF
       Show only metadata and comments for the ticket 1234 (but not
       history).
 
-    $cmd ticket show 1234 --show-history
+    $cmd ticket show 1234 --with-history
       Override the disable_ticket_show_history_by_default config option
       if it is set for this database. (See '$cmd help config' for
       more info.)
diff --git a/lib/App/SD/CLI/Command/Ticket/Show.pm b/lib/App/SD/CLI/Command/Ticket/Show.pm
index aed8a4c..ecbce0a 100644
--- a/lib/App/SD/CLI/Command/Ticket/Show.pm
+++ b/lib/App/SD/CLI/Command/Ticket/Show.pm
@@ -44,10 +44,10 @@ override run => sub {
 
     # allow user to not display history by specifying the --skip-history
     # arg or setting disable_ticket_show_history_by_default config item to a
-    # true value (can be overridden with --show-history)
+    # true value (can be overridden with --with-history)
     if (!$self->has_arg('skip-history') && (!$self->app_handle->config->get(
                 'disable_ticket_show_history_by_default') ||
-            $self->has_arg('show-history'))) {
+            $self->has_arg('with-history'))) {
         print "\n= HISTORY\n\n";
         print $record->history_as_string;
     }
diff --git a/t/06-ticket-show.t b/t/06-ticket-show.t
index 2b635d3..989bb0e 100644
--- a/t/06-ticket-show.t
+++ b/t/06-ticket-show.t
@@ -104,8 +104,8 @@ diag("and --skip-history passed (shouldn't show history)");
 
 check_output_without_history('--skip-history');
 
-# config option set and --show-history passed (should show history)
+# config option set and --with-history passed (should show history)
 diag('config option disable_ticket_show_history_by_default set');
-diag('and --show-history passed (should show history)');
+diag('and --with-history passed (should show history)');
 
-check_output_with_history('--show-history');
+check_output_with_history('--with-history');

commit 9936b0f26b29240c32733f42f2e68510b44e5d52
Author: Christine Spang <spang at bestpractical.com>
Date:   Wed Jan 28 17:18:36 2009 +0200

    fix give and un-TODO its tests

diff --git a/lib/App/SD/CLI/Dispatcher.pm b/lib/App/SD/CLI/Dispatcher.pm
index e70485d..c609e32 100644
--- a/lib/App/SD/CLI/Dispatcher.pm
+++ b/lib/App/SD/CLI/Dispatcher.pm
@@ -56,11 +56,20 @@ under ticket => sub {
     on comment  => run_command('Ticket::Comment');
     on details  => run_command('Ticket::Details');
 
-    on ['give', qr/.*/, qr/.*/] => sub {
-        my $self = shift;
-        $self->context->set_arg(id    => $2);
-        $self->context->set_arg(owner => $3);
-        run('ticket update', $self, @_);
+    under give => sub {
+        on [qr/^(?:\d+|[0-9a-f]{8}\-[0-9a-f]{4}\-[0-9a-f]{4}\-[0-9a-f]{4}\-[0-9a-f]{12})$/, qr/^\S+$/] => sub {
+            my $self = shift;
+            my ($id, $owner) = ($1, $2);
+
+            $self->context->set_arg(id    => $id);
+            $self->context->set_arg(type    => 'ticket');
+            $self->context->set_prop(owner => $owner);
+            $self->context->set_type_and_uuid;
+            run('ticket update', $self, @_);
+        };
+        on qr/^(.*)$/ => sub {
+            die "Usage: give <id> <email>\n";
+        };
     };
 
     on [ ['resolve', 'close'] ] => sub {
diff --git a/t/sd-dispatcher.t b/t/sd-dispatcher.t
index 4b721f8..398970b 100644
--- a/t/sd-dispatcher.t
+++ b/t/sd-dispatcher.t
@@ -2,7 +2,7 @@
 
 use strict;
 
-use Prophet::Test tests => 16;
+use Prophet::Test tests => 20;
 use App::SD::Test;
 no warnings 'once';
 
@@ -12,7 +12,7 @@ BEGIN {
     warn $ENV{'PROPHET_REPO'};
 }
 
-# tests for pseudo-commands that are only in the dispatcher
+# tests for pseudo-commands that are only sugar in the dispatcher
 
 run_script( 'sd', [ 'init']);
 
@@ -143,25 +143,42 @@ run_output_matches( 'sd', [ 'ticket', 'basics', '--batch', '--id', $yatta_id ],
     ]
 );
 
-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: closed',
-            '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,
-        ]
-    );
-};
+# 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: closed',
+        '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,
+    ]
+);
+
+run_output_matches( 'sd', [ 'ticket', 'give' ],
+    [],
+    [ 'Usage: give <id> <email>' ]
+);
+
+run_output_matches( 'sd', [ 'ticket', 'give', $yatta_id ],
+    [],
+    [ 'Usage: give <id> <email>' ]
+);
+
+run_output_matches( 'sd', [ 'ticket', 'give', 'foo at bar.com', $yatta_id ],
+    [],
+    [ 'Usage: give <id> <email>' ]
+);
+
+run_output_matches( 'sd', [ 'ticket', 'give', 'spang at bestpractical.com' ],
+    [],
+    [ 'Usage: give <id> <email>' ]
+);

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



More information about the Bps-public-commit mailing list