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

spang at bestpractical.com spang at bestpractical.com
Thu Jan 22 05:43:27 EST 2009


The branch, master has been updated
       via  b50a9e7f7f70269c7c421b5ba4440877acc4f6f3 (commit)
       via  c51da0e1762a211857c30d4dc3dcab8a4cd932a7 (commit)
       via  4afb32a295995920e73bdd8980abb91516b66af2 (commit)
       via  6eca8bea650cd98f01103a888508372ebb26f444 (commit)
      from  ca59c3c0884aaa32871c2970b8cf8cdff3214936 (commit)

Summary of changes:
 lib/App/SD/CLI/Command/Log.pm       |    4 +-
 lib/App/SD/Collection/Attachment.pm |   10 +++---
 lib/App/SD/Collection/Comment.pm    |    9 +++--
 lib/App/SD/Collection/Ticket.pm     |    9 +++--
 t/data/sd-settings.tmpl             |   31 ++++++++++++++++++
 t/sd-log.t                          |   52 +++++++++++++++++++++++++++++++
 t/sd-settings.t                     |   58 +++++++++++++++++++++++++++++++++++
 7 files changed, 158 insertions(+), 15 deletions(-)
 create mode 100644 t/data/sd-settings.tmpl
 create mode 100644 t/sd-log.t
 create mode 100644 t/sd-settings.t

- Log -----------------------------------------------------------------
commit 6eca8bea650cd98f01103a888508372ebb26f444
Author: Christine Spang <spang at bestpractical.com>
Date:   Wed Jan 21 18:05:17 2009 +0200

    initial test coverage for settings command

diff --git a/t/data/sd-settings.tmpl b/t/data/sd-settings.tmpl
new file mode 100644
index 0000000..8f1528b
--- /dev/null
+++ b/t/data/sd-settings.tmpl
@@ -0,0 +1,31 @@
+# uuid: 1AF5CF74-A6D4-417E-A738-CCE64A0A7F71
+milestones: ["alpha","beta","1.0"]
+
+# uuid: 0AEC922F-57B1-44BE-9588-816E5841BB18
+default_component: ["core"]
+
+# uuid: 6CBD84A1-4568-48E7-B90C-F1A5B7BD8ECD
+components: ["core","ui","docs","tests"]
+
+# uuid: 3f0a074f-af13-406f-bf7b-d69bbf360720
+common_ticket_props: ["id","summary","original_replica"]
+
+# uuid: 2F9E6509-4468-438A-A733-246B3061003E
+default_status: ["new"]
+
+# uuid: C879A68F-8CFE-44B5-9EDD-14E53933669E
+active_statuses: ["new","open"]
+
+# uuid: BAB613BD-9E25-4612-8DE3-21E4572859EA
+default_milestone: ["alpha"]
+
+# uuid: c1bced3a-ad2c-42c4-a502-4149205060f1
+prop_descriptions: [{"due":"when this ticket must be finished by (ISO 8601 format)","owner":"the email address of the person who is responsible for this ticket","reporter":"the email address of the person who reported this ticket","summary":"a one-line summary of what this ticket is about"}]
+
+# uuid: 24183C4D-EFD0-4B16-A207-ED7598E875E6
+statuses: ["new","open","stalled","closed","rejected"]
+
+# uuid: 3B4B297C-906F-4018-9829-F7CC672274C9
+project_name: ["Your SD Project"]
+
+
diff --git a/t/sd-settings.t b/t/sd-settings.t
new file mode 100644
index 0000000..27d4812
--- /dev/null
+++ b/t/sd-settings.t
@@ -0,0 +1,58 @@
+#!/usr/bin/perl -w
+
+use strict;
+
+use Prophet::Test tests => 2;
+use App::SD::Test;
+use Prophet::Util;
+no warnings 'once';
+
+# test the CLI and interactive UIs for showing and updating settings
+
+BEGIN {
+    require File::Temp;
+    $ENV{'PROPHET_REPO'} = $ENV{'SD_REPO'}
+        = File::Temp::tempdir( CLEANUP => 0 ) . '/_svb';
+    diag $ENV{'PROPHET_REPO'};
+}
+
+run_script( 'sd', [ 'init']);
+
+
+my $replica_uuid = replica_uuid;
+
+# test noninteractive set
+run_output_matches( 'sd', [ 'settings', '--set', '--', 'common_ticket_props',
+    '["id","summary","original_replica"]' ],
+    [
+        'Trying to change common_ticket_props from ["id","summary","status","milestone","component","owner","created","due","creator","reporter","original_replica"] to ["id","summary","original_replica"].',
+        'Changed common_ticket_props from ["id","summary","status","milestone","component","owner","created","due","creator","reporter","original_replica"] to ["id","summary","original_replica"].',
+    ], [], "settings --set went ok",
+);
+
+# check with settings --show
+my @valid_settings_output = Prophet::Util->slurp('t/data/sd-settings.tmpl');
+chomp (@valid_settings_output);
+
+run_output_matches(
+    'sd',
+    [ qw/settings --show/ ],
+    [ @valid_settings_output ], [], "changed settings output matches"
+);
+
+# test sd settings (interactive editing)
+
+# first set the editor to an editor script
+# App::SD::Test->set_editor("ticket-update-editor.pl --verbose $replica_uuid $ticket_uuid");
+
+# then edit the settings
+# run_output_matches( 'sd', [ 'settings' ],
+#     [
+#         'Trying to change common_ticket_props from ["id","summary","status","milestone","component","owner","created","due","creator","reporter","original_replica"] to ["id","summary","original_replica"].',
+#         'Changed common_ticket_props from ["id","summary","status","milestone","component","owner","created","due","creator","reporter","original_replica"] to ["id","summary","original_replica"].',
+#     ], [], "interactive settings set went ok",
+# );
+
+# check the settings with settings --show
+
+# test setting to invalid json

commit 4afb32a295995920e73bdd8980abb91516b66af2
Author: Christine Spang <spang at bestpractical.com>
Date:   Thu Jan 22 11:26:52 2009 +0200

    don't try to call Class->type as if type were a class attribute

diff --git a/lib/App/SD/CLI/Command/Log.pm b/lib/App/SD/CLI/Command/Log.pm
index 393c596..e5b7f5e 100644
--- a/lib/App/SD/CLI/Command/Log.pm
+++ b/lib/App/SD/CLI/Command/Log.pm
@@ -59,7 +59,7 @@ sub change_header_comment {
     my $self = shift;
     my $change = shift;
     require App::SD::Model::Comment;
-    my $c = App::SD::Model::Comment->new( handle => $self->handle, type => App::SD::Model::Comment->type);
+    my $c = App::SD::Model::Comment->new( app_handle => $self->app_handle );
     $c->load(uuid => $change->record_uuid);
     if ($c->prop('ticket')) {
     my $t = $c->ticket;
@@ -73,7 +73,7 @@ sub change_header_ticket {
     my $self = shift;
     my $change = shift;
     require App::SD::Model::Ticket;
-    my $t = App::SD::Model::Ticket->new( handle => $self->handle, type => App::SD::Model::Ticket->type);
+    my $t = App::SD::Model::Ticket->new( app_handle => $self->app_handle );
     $t->load(uuid => $change->record_uuid);
     unless ($t->uuid) {
         return $self->change_header_generic($change);

commit c51da0e1762a211857c30d4dc3dcab8a4cd932a7
Author: Christine Spang <spang at bestpractical.com>
Date:   Thu Jan 22 12:07:01 2009 +0200

    initial tests for sd log

diff --git a/t/sd-log.t b/t/sd-log.t
new file mode 100644
index 0000000..df4d605
--- /dev/null
+++ b/t/sd-log.t
@@ -0,0 +1,52 @@
+#!/usr/bin/perl -w
+
+use strict;
+
+use Prophet::Test tests => 2;
+use App::SD::Test;
+use Prophet::Util;
+no warnings 'once';
+
+# test the 'log' command
+
+BEGIN {
+    require File::Temp;
+    $ENV{'PROPHET_REPO'} = $ENV{'SD_REPO'}
+        = File::Temp::tempdir( CLEANUP => 0 ) . '/_svb';
+    diag $ENV{'PROPHET_REPO'};
+}
+
+run_script( 'sd', [ 'init']);
+
+my $replica_uuid = replica_uuid;
+
+# args for the log command: --last, --count
+# count does: specifies the number of log entries to output
+# last does: specifies the last entry that you want shown (newest entry is default)
+
+# create a ticket
+my ($log_id, $log_uuid) = create_ticket_ok( '--', 'summary', 'logs rock!');
+# check the log
+
+run_output_matches( 'sd', [ 'log', '--count', '1' ],
+    [
+        qr/^\d{4}-\d{2}-\d{2}.+ - $ENV{USER} @ $replica_uuid$/,
+        qr/^ # Ticket \d+ \(logs rock!\)$/,
+        '  + "original_replica" set to "'.$replica_uuid.'"',
+        '  + "creator" set to "'.$ENV{USER}.'"',
+        '  + "status" set to "new"',
+        '  + "reporter" set to "'.$ENV{EMAIL}.'"',
+        qr/^  \+ "created" set to "\d{4}-\d{2}-\d{2}.+"$/,
+        '  + "component" set to "core"',
+        '  + "summary" set to "logs rock!"',
+        '  + "milestone" set to "alpha"',
+        '',
+    ], [], "log output is correct",
+);
+# delete a prop
+# check the log
+
+# change a prop
+# check the log
+
+# check the log specifying --count --last

commit b50a9e7f7f70269c7c421b5ba4440877acc4f6f3
Author: Christine Spang <spang at bestpractical.com>
Date:   Thu Jan 22 12:36:28 2009 +0200

    moosify these classes

diff --git a/lib/App/SD/Collection/Attachment.pm b/lib/App/SD/Collection/Attachment.pm
index 723ea12..caab8aa 100644
--- a/lib/App/SD/Collection/Attachment.pm
+++ b/lib/App/SD/Collection/Attachment.pm
@@ -1,10 +1,10 @@
-use warnings;
-use strict;
-
 package App::SD::Collection::Attachment;
-use base 'Prophet::Collection';
+use Moose;
+extends 'Prophet::Collection';
 
 use constant record_class => 'App::SD::Model::Attachment';
 
-1;
+__PACKAGE__->meta->make_immutable;
+no Moose;
 
+1;
diff --git a/lib/App/SD/Collection/Comment.pm b/lib/App/SD/Collection/Comment.pm
index 571d082..c2d9ae0 100644
--- a/lib/App/SD/Collection/Comment.pm
+++ b/lib/App/SD/Collection/Comment.pm
@@ -1,10 +1,11 @@
-use warnings;
-use strict;
-
 package App::SD::Collection::Comment;
-use base 'Prophet::Collection';
+use Moose;
+extends 'Prophet::Collection';
 
 use constant record_class => 'App::SD::Model::Comment';
 
+__PACKAGE__->meta->make_immutable;
+no Moose;
+
 1;
 
diff --git a/lib/App/SD/Collection/Ticket.pm b/lib/App/SD/Collection/Ticket.pm
index cb29eb8..db4d2af 100644
--- a/lib/App/SD/Collection/Ticket.pm
+++ b/lib/App/SD/Collection/Ticket.pm
@@ -1,10 +1,11 @@
-use warnings;
-use strict;
-
 package App::SD::Collection::Ticket;
-use base 'Prophet::Collection';
+use Moose;
+extends 'Prophet::Collection';
 
 use constant record_class => 'App::SD::Model::Ticket';
 
+__PACKAGE__->meta->make_immutable;
+no Moose;
+
 1;
 

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



More information about the Bps-public-commit mailing list