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

sunnavy at bestpractical.com sunnavy at bestpractical.com
Sat May 10 08:51:06 EDT 2008


Author: sunnavy
Date: Sat May 10 08:51:06 2008
New Revision: 12214

Modified:
   Shipwright/trunk/lib/Shipwright/Script.pm
   Shipwright/trunk/lib/Shipwright/Script/Build.pm
   Shipwright/trunk/lib/Shipwright/Script/Create.pm
   Shipwright/trunk/lib/Shipwright/Script/Flags.pm
   Shipwright/trunk/lib/Shipwright/Script/Import.pm
   Shipwright/trunk/lib/Shipwright/Script/List.pm
   Shipwright/trunk/lib/Shipwright/Script/Maintain.pm
   Shipwright/trunk/lib/Shipwright/Script/Update.pm

Log:
show help if not given --repository arg, except the help cmd itself ;)

Modified: Shipwright/trunk/lib/Shipwright/Script.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Script.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Script.pm	Sat May 10 08:51:06 2008
@@ -8,7 +8,7 @@
 =cut
 
 sub alias {
-    return ( ls => 'list');
+    return ( ls => 'list' );
 }
 
 =head2 prepare
@@ -22,6 +22,10 @@
         $ARGV[0] = 'help';
     }
 
+    # all the cmds need --repository arg
+    unless ( $ARGV[0] ne 'help' && grep { /-r|--repository/ } @ARGV ) {
+        unshift @ARGV, 'help';
+    }
 
     return $self->SUPER::prepare(@_);
 }
@@ -31,8 +35,8 @@
 
 sub log {
     my $self = shift;
-    Shipwright::Logger->new( $self );
-    return Log::Log4perl->get_logger( ref $self ) ;
+    Shipwright::Logger->new($self);
+    return Log::Log4perl->get_logger( ref $self );
 }
 
 1;

Modified: Shipwright/trunk/lib/Shipwright/Script/Build.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Script/Build.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Script/Build.pm	Sat May 10 08:51:06 2008
@@ -40,8 +40,6 @@
     $self->install_base($install_base)
       if $install_base && !$self->install_base;
 
-    die "need repository arg" unless $self->repository;
-
     unless ( $self->name ) {
         if ( $self->repository =~ m{([-.\w]+)/([.\d]+)$} ) {
             $self->name("$1-$2");

Modified: Shipwright/trunk/lib/Shipwright/Script/Create.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Script/Create.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Script/Create.pm	Sat May 10 08:51:06 2008
@@ -27,10 +27,7 @@
 
 sub run {
     my $self       = shift;
-    my $repository = shift;
-    $self->repository($repository) if $repository && ! $self->repository;
-    die 'need repository arg' unless $self->repository;
-
+    
     my $shipwright = Shipwright->new(
         repository => $self->repository,
         log_level  => $self->log_level,

Modified: Shipwright/trunk/lib/Shipwright/Script/Flags.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Script/Flags.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Script/Flags.pm	Sat May 10 08:51:06 2008
@@ -35,9 +35,7 @@
 
     $self->dist if $dist && !$self->dist;
 
-    for (qw/repository dist/) {
-        die "need $_ arg" unless $self->$_();
-    }
+    die "need dist arg" unless $self->dist();
 
     my $shipwright = Shipwright->new(
         repository => $self->repository,

Modified: Shipwright/trunk/lib/Shipwright/Script/Import.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Script/Import.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Script/Import.pm	Sat May 10 08:51:06 2008
@@ -45,7 +45,7 @@
     );
 }
 
-my (%imported, $version);
+my ( %imported, $version );
 
 =head2 run
 =cut
@@ -58,9 +58,7 @@
     $self->follow(1) unless defined $self->follow;
     $self->skip( { map { $_ => 1 } split /\s*,\s*/, $self->skip || '' } );
 
-    for (qw/repository source/) {
-        die "need $_ arg" unless $self->$_();
-    }
+    die "need source arg" unless $self->source();
 
     if ( $self->name ) {
         if ( $self->name =~ /::/ ) {
@@ -137,8 +135,8 @@
         $shipwright->backend->import(
             source  => $self->source,
             comment => $self->comment || 'import ' . $self->source,
-            overwrite => 1,    # import anyway for the main dist
-            version => $version->{$name},
+            overwrite => 1,                   # import anyway for the main dist
+            version   => $version->{$name},
         );
         $shipwright->backend->import(
             source       => $self->source,

Modified: Shipwright/trunk/lib/Shipwright/Script/List.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Script/List.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Script/List.pm	Sat May 10 08:51:06 2008
@@ -32,8 +32,6 @@
     my $self = shift;
     my $dist = shift;
 
-    die "need repository arg" unless $self->repository();
-
     $self->dist($dist) if $dist && !$self->dist;
 
     my $shipwright = Shipwright->new(

Modified: Shipwright/trunk/lib/Shipwright/Script/Maintain.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Script/Maintain.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Script/Maintain.pm	Sat May 10 08:51:06 2008
@@ -34,8 +34,6 @@
 sub run {
     my $self = shift;
 
-    die "need repository arg" unless $self->repository();
-
     my $shipwright = Shipwright->new(
         repository => $self->repository,
         log_level  => $self->log_level,

Modified: Shipwright/trunk/lib/Shipwright/Script/Update.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Script/Update.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Script/Update.pm	Sat May 10 08:51:06 2008
@@ -42,10 +42,6 @@
 
     $self->name($name) if $name && ! $self->name;
 
-    for (qw/repository/) {
-        die "need $_ arg" unless $self->$_();
-    }
-
     die 'need name arg' unless $self->name || $self->all;
 
     $shipwright = Shipwright->new(



More information about the Bps-public-commit mailing list