[Bps-public-commit] r15782 - in Prophet/trunk: bin lib/Prophet/CLI/Command lib/Prophet/Test t

jesse at bestpractical.com jesse at bestpractical.com
Sun Sep 7 16:35:44 EDT 2008


Author: jesse
Date: Sun Sep  7 16:35:43 2008
New Revision: 15782

Modified:
   Prophet/trunk/bin/prophet
   Prophet/trunk/lib/Prophet/CLI.pm
   Prophet/trunk/lib/Prophet/CLI/Command/Shell.pm
   Prophet/trunk/lib/Prophet/CLIContext.pm
   Prophet/trunk/lib/Prophet/Test/Participant.pm
   Prophet/trunk/t/export.t

Log:
* Fixes to our "run one command" logic to be able to run the shell


Modified: Prophet/trunk/bin/prophet
==============================================================================
--- Prophet/trunk/bin/prophet	(original)
+++ Prophet/trunk/bin/prophet	Sun Sep  7 16:35:43 2008
@@ -4,5 +4,4 @@
 
 use Prophet::CLI;
 my $cli = Prophet::CLI->new();
-$cli->run_one_command();
-
+$cli->run_one_command(@ARGV);

Modified: Prophet/trunk/lib/Prophet/CLI.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/CLI.pm	(original)
+++ Prophet/trunk/lib/Prophet/CLI.pm	Sun Sep  7 16:35:43 2008
@@ -141,13 +141,14 @@
 Example:
 
  my $cli = Prophet::CLI->new({ app_class => 'App::SD' });
-$cli->run_one_command(@ARGV);
+ $cli->run_one_command(@ARGV);
 
 =cut
 
 sub run_one_command {
     my $self = shift;
-    my @args = (@_ || @ARGV);
+    my @args = (@_);
+
      #  really, we shouldn't be doing this stuff from the command dispatcher
 
    $self->context(Prophet::CLIContext->new( app_handle => $self->app_handle)); 
@@ -157,7 +158,7 @@
     }
 }
 
-=head2 invoke [outhandle], ARGV
+=head2 invoke outhandle, ARGV_COMPATIBLE_ARRAY
 
 Run the given command. If outhandle is true, select that as the file handle
 for the duration of the command.
@@ -168,11 +169,10 @@
     my ($self, $output, @args) = @_;
     my $ofh;
 
-    local *ARGV = \@args;
     $ofh = select $output if $output;
     my $ret = eval {
         local $SIG{__DIE__} = 'DEFAULT';
-        $self->run_one_command
+        $self->run_one_command(@args);
     };
     warn $@ if $@;
     select $ofh if $ofh;

Modified: Prophet/trunk/lib/Prophet/CLI/Command/Shell.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/CLI/Command/Shell.pm	(original)
+++ Prophet/trunk/lib/Prophet/CLI/Command/Shell.pm	Sun Sep  7 16:35:43 2008
@@ -47,11 +47,6 @@
 sub eval {
     my $self = shift;
     my $line = shift;
- 
-
-    # XXX TODO - really, we should be replacing the context and cli objects here and handing fresh ones in for the this eval
-    $self->context->clear_args;
-    $self->context->clear_props;
 
     eval {
         local $SIG{__DIE__} = 'DEFAULT';

Modified: Prophet/trunk/lib/Prophet/CLIContext.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/CLIContext.pm	(original)
+++ Prophet/trunk/lib/Prophet/CLIContext.pm	Sun Sep  7 16:35:43 2008
@@ -139,7 +139,7 @@
 
 sub setup_from_args {
     my $self = shift;
-    $self->parse_args(@ARGV);
+    $self->parse_args(@_);
     $self->set_type_and_uuid();
 
 }

Modified: Prophet/trunk/lib/Prophet/Test/Participant.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/Test/Participant.pm	(original)
+++ Prophet/trunk/lib/Prophet/Test/Participant.pm	Sun Sep  7 16:35:43 2008
@@ -177,7 +177,6 @@
     Carp::cluck unless ref $_[0];
 
     my @args = @{ shift @_ };
-    local (@ARGV) = (@args);
     my $cli = Prophet::CLI->new();
 
     my $str = '';
@@ -190,7 +189,7 @@
         $p->('SVN::Pool');    
     };
 
-    $ret = $cli->run_one_command();
+    $ret = $cli->run_one_command(@args);
     select($old_fh) if defined $old_fh;
 
     return ( $ret, $str, undef );

Modified: Prophet/trunk/t/export.t
==============================================================================
--- Prophet/trunk/t/export.t	(original)
+++ Prophet/trunk/t/export.t	Sun Sep  7 16:35:43 2008
@@ -6,7 +6,6 @@
 
 use Prophet::Test tests => 16;
 use Test::Exception;
-
 as_alice {
     run_ok( 'prophet', [qw(create --type Bug -- --status new --from alice )], "Created a record as alice" );
     run_output_matches( 'prophet', [qw(search --type Bug --regex .)], [qr/new/], " Found our record" );



More information about the Bps-public-commit mailing list