[Bps-public-commit] r12866 - in Shipwright/trunk: lib/Shipwright/Script

sunnavy at bestpractical.com sunnavy at bestpractical.com
Wed Jun 4 11:00:33 EDT 2008


Author: sunnavy
Date: Wed Jun  4 11:00:29 2008
New Revision: 12866

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

Log:
 r12948 at sunnavys-mb:  sunnavy | 2008-06-04 22:59:25 +0800
 show success msg for flags cmd


Modified: Shipwright/trunk/lib/Shipwright/Script/Flags.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Script/Flags.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Script/Flags.pm	Wed Jun  4 11:00:29 2008
@@ -27,10 +27,12 @@
     my $self = shift;
     my $name = shift;
 
-    $self->name if $name && !$self->name;
+    $self->name($name) if $name && !$self->name;
 
     die "need name arg" unless $self->name();
 
+    $name = $self->name;
+
     my $shipwright = Shipwright->new(
         repository => $self->repository,
         log_level  => $self->log_level,
@@ -41,7 +43,7 @@
 
     unless ( defined $self->add || defined $self->delete || defined $self->set )
     {
-        print join( ', ', @{ $flags->{ $self->name } || [] } ), "\n";
+        print join( ', ', @{ $flags->{$name} || [] } ), "\n";
         return;
     }
 
@@ -51,24 +53,25 @@
 
     if ( defined $self->add ) {
         $self->add( [ grep { /^\w+$/ } split /,\s*/, $self->add ] );
-        $flags->{ $self->name } =
-          [ uniq @{ $self->add }, @{ $flags->{ $self->name } || [] } ];
+        $flags->{$name} = [ uniq @{ $self->add }, @{ $flags->{$name} || [] } ];
     }
     elsif ( defined $self->delete ) {
         $self->delete( [ split /,\s*/, $self->delete ] );
         my %seen;    # lookup table
         @seen{ @{ $self->delete } } = ();
 
-        @{ $flags->{ $self->name } } =
-          grep { exists $seen{$_} } @{ $flags->{ $self->name } || [] };
+        @{ $flags->{$name} } =
+          grep { exists $seen{$_} } @{ $flags->{$name} || [] };
 
     }
     elsif ( defined $self->set ) {
-        $flags->{ $self->name } = [ grep { /^\w+$/ } split /,\s*/, $self->set ];
+        $flags->{$name} = [ grep { /^\w+$/ } split /,\s*/, $self->set ];
     }
 
-    $shipwright->backend->flags( $flags );
+    $shipwright->backend->flags($flags);
 
+    print "set flags with success, current flags for $name is "
+      . join( ',', @{ $flags->{$name} } ) . "\n";
 }
 
 1;



More information about the Bps-public-commit mailing list