[Bps-public-commit] r15971 - in sd/trunk: . lib/App/SD/CLI lib/App/SD/CLI/Command lib/App/SD/CLI/Command/Ticket
jesse at bestpractical.com
jesse at bestpractical.com
Mon Sep 15 00:20:07 EDT 2008
Author: jesse
Date: Mon Sep 15 00:20:06 2008
New Revision: 15971
Modified:
sd/trunk/Makefile.PL
sd/trunk/lib/App/SD/CLI/Command/Log.pm
sd/trunk/lib/App/SD/CLI/Command/Ticket/Show.pm
sd/trunk/lib/App/SD/CLI/Dispatcher.pm
sd/trunk/t/01-create.t
sd/trunk/t/02-create-with-editor.t
sd/trunk/t/03-update-ticket-with-editor.t
Log:
switched show to show full ticket details
cleaned up show format
fixed some help commands for push/pull to actually work
Modified: sd/trunk/Makefile.PL
==============================================================================
--- sd/trunk/Makefile.PL (original)
+++ sd/trunk/Makefile.PL Mon Sep 15 00:20:06 2008
@@ -5,7 +5,7 @@
license('MIT');
version_from('lib/App/SD.pm');
requires('Time::Progress');
-requires 'Prophet'; # URI UNIVERSAL::require Params::Validate Path::Class Class::Accessor
+requires 'Prophet'; # URI UNIVERSAL::require Params::Validate Path::Class Class::Accessor Template::Declare::Tags
requires('Moose'); # Moose::Role
requires('HTTP::Date');
Modified: sd/trunk/lib/App/SD/CLI/Command/Log.pm
==============================================================================
--- sd/trunk/lib/App/SD/CLI/Command/Log.pm (original)
+++ sd/trunk/lib/App/SD/CLI/Command/Log.pm Mon Sep 15 00:20:06 2008
@@ -39,6 +39,12 @@
}
else {
+ return $self->change_header_generic($change);
+ }
+}
+sub change_header_generic {
+ my $self = shift;
+ my $change = shift;
return
" # "
. ucfirst($change->record_type) . " "
@@ -46,7 +52,6 @@
uuid => $change->record_uuid )
. " ("
. $change->record_uuid . ")";
- }
}
@@ -71,6 +76,9 @@
require App::SD::Model::Ticket;
my $t = App::SD::Model::Ticket->new( handle => $self->handle, type => App::SD::Model::Ticket->type);
$t->load(uuid => $change->record_uuid);
+ unless ($t->uuid) {
+ return $self->change_header_generic($change);
+ }
return " # Ticket "
. $self->app_handle->handle->find_or_create_luid(
uuid => $change->record_uuid )
Modified: sd/trunk/lib/App/SD/CLI/Command/Ticket/Show.pm
==============================================================================
--- sd/trunk/lib/App/SD/CLI/Command/Ticket/Show.pm (original)
+++ sd/trunk/lib/App/SD/CLI/Command/Ticket/Show.pm Mon Sep 15 00:20:06 2008
@@ -4,8 +4,42 @@
with 'App::SD::CLI::Command';
with 'App::SD::CLI::Model::Ticket';
+
+sub by_creation_date { $a->prop('created') cmp $b->prop('created') };
+
+override run => sub {
+ my $self = shift;
+
+ $self->require_uuid;
+ my $record = $self->_load_record;
+
+ print "\n= METADATA\n\n";
+ super();
+
+ my @attachments = sort by_creation_date @{$record->attachments};
+ if (@attachments) {
+ print "\n= ATTACHMENTS\n\n";
+ print $_->format_summary . "\n"
+ for @attachments;
+ }
+
+ my @comments = sort by_creation_date @{$record->comments};
+ if (@comments) {
+ print "\n= COMMENTS\n\n";
+ foreach my $comment (@comments) {
+ my $creator = $comment->prop('creator');
+ my $created = $comment->prop('created');
+ my $content = $comment->prop('content');
+ print "$creator: " if $creator;
+ print "$created\n$content\n\n";
+ }
+ }
+
+ print "\n= HISTORY\n\n";
+ print $record->history_as_string;
+};
+
__PACKAGE__->meta->make_immutable;
no Moose;
1;
-
Modified: sd/trunk/lib/App/SD/CLI/Dispatcher.pm
==============================================================================
--- sd/trunk/lib/App/SD/CLI/Dispatcher.pm (original)
+++ sd/trunk/lib/App/SD/CLI/Dispatcher.pm Mon Sep 15 00:20:06 2008
@@ -9,6 +9,7 @@
# 'sd about' -> 'sd help about', 'sd copying' -> 'sd help copying'
on qr'^(about|copying)$' => sub { run('help '.$1, @_); last_rule;};
+on qr'^help (push|pull|publish|server)$' => sub { run('help sync', @_); last_rule;};
# allow type to be specified via primary commands, e.g.
# 'sd ticket display --id 14' -> 'sd display --type ticket --id 14'
@@ -18,6 +19,11 @@
run($2, %args);
};
+
+#on qr'^about$' => sub { run('help about'); last_rule;};
+
+
+# Run class based commands
on qr{.} => sub {
my %args = @_;
my $cli = $args{cli};
@@ -37,13 +43,15 @@
}
for my $class (@possible_classes) {
- if ($cli->_try_to_load_cmd_class($class)) {
- return $args{got_command}->($class);
+ if ($args{cli}->_try_to_load_cmd_class($class)) {
+ return $args{got_command}->($class)
}
}
+ # found no class-based rule
next_rule;
};
+
1;
Modified: sd/trunk/t/01-create.t
==============================================================================
--- sd/trunk/t/01-create.t (original)
+++ sd/trunk/t/01-create.t Mon Sep 15 00:20:06 2008
@@ -25,7 +25,7 @@
);
-run_output_matches( 'sd', [ 'ticket', 'show', '--batch', '--id', $yatta_id ],
+run_output_matches( 'sd', [ 'ticket', 'basics', '--batch', '--id', $yatta_id ],
[
"id: $yatta_id ($yatta_uuid)",
'summary: YATTA',
Modified: sd/trunk/t/02-create-with-editor.t
==============================================================================
--- sd/trunk/t/02-create-with-editor.t (original)
+++ sd/trunk/t/02-create-with-editor.t Mon Sep 15 00:20:06 2008
@@ -19,7 +19,7 @@
[ qr/(\d+) creating tickets with an editor is totally awesome new/]
);
-run_output_matches( 'sd', [ 'ticket', 'show', '--batch', '--id', $ticket_id ],
+run_output_matches( 'sd', [ 'ticket', 'basics', '--batch', '--id', $ticket_id ],
[
"id: $ticket_id ($ticket_uuid)",
'summary: creating tickets with an editor is totally awesome',
Modified: sd/trunk/t/03-update-ticket-with-editor.t
==============================================================================
--- sd/trunk/t/03-update-ticket-with-editor.t (original)
+++ sd/trunk/t/03-update-ticket-with-editor.t Mon Sep 15 00:20:06 2008
@@ -18,7 +18,7 @@
'--owner', 'foo at bar.com');
# verify that it's correct (test prop won't be shown)
-run_output_matches( 'sd', [ 'ticket', 'show', '--batch', '--id', $ticket_id ],
+run_output_matches( 'sd', [ 'ticket', 'basics', '--batch', '--id', $ticket_id ],
[
"id: $ticket_id ($ticket_uuid)",
'summary: zomg!',
@@ -34,7 +34,7 @@
my ($comment_id, $comment_uuid) = App::SD::Test->update_ticket_with_editor_ok($ticket_id, $ticket_uuid);
# check output
-run_output_matches( 'sd', [ 'ticket', 'show', '--batch', '--id', $ticket_id ],
+run_output_matches( 'sd', [ 'ticket', 'basics', '--batch', '--id', $ticket_id ],
[
"id: $ticket_id ($ticket_uuid)",
'summary: summary changed',
More information about the Bps-public-commit
mailing list