[Bps-public-commit] r12244 -

sunnavy at bestpractical.com sunnavy at bestpractical.com
Mon May 12 06:44:41 EDT 2008


Author: sunnavy
Date: Mon May 12 06:44:39 2008
New Revision: 12244

Modified:
   /   (props changed)
   Shipwright/trunk/lib/Shipwright/Script.pm

Log:
 r12249 at sunnavys-mb:  sunnavy | 2008-05-12 16:26:10 +0800
 check repository asap


Modified: Shipwright/trunk/lib/Shipwright/Script.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Script.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Script.pm	Mon May 12 06:44:39 2008
@@ -23,8 +23,22 @@
     }
 
     # all the cmds need --repository arg
-    unless ( $ARGV[0] ne 'help' && grep { /^(-r|--repository)$/ } @ARGV ) {
-        unshift @ARGV, 'help';
+    if ( $ARGV[0] ne 'help' ) {
+        my %args = @ARGV[ 1 .. $#ARGV ];
+        my $repo = $args{'-r'} || $args{'--repository'};
+
+        if ($repo) {
+
+            my $backend = Shipwright::Backend->new( repository => $repo, );
+
+            my $valid = $backend->check_repository( action => $ARGV[0] );
+
+            die "invalid repository: $repo"
+              unless $backend->check_repository( action => $ARGV[0] );
+        }
+        else {
+            unshift @ARGV, 'help';
+        }
     }
 
     return $self->SUPER::prepare(@_);



More information about the Bps-public-commit mailing list