[Bps-public-commit] r10155 - bpsbuilder/BPB/lib/BPB/Script

sunnavy at bestpractical.com sunnavy at bestpractical.com
Thu Dec 27 11:05:46 EST 2007


Author: sunnavy
Date: Thu Dec 27 11:05:45 2007
New Revision: 10155

Modified:
   bpsbuilder/BPB/lib/BPB/Script/Build.pm
   bpsbuilder/BPB/lib/BPB/Script/Export.pm
   bpsbuilder/BPB/lib/BPB/Script/Import.pm
   bpsbuilder/BPB/lib/BPB/Script/Initialize.pm

Log:
check necessary cli args in Script/

Modified: bpsbuilder/BPB/lib/BPB/Script/Build.pm
==============================================================================
--- bpsbuilder/BPB/lib/BPB/Script/Build.pm	(original)
+++ bpsbuilder/BPB/lib/BPB/Script/Build.pm	Thu Dec 27 11:05:45 2007
@@ -5,31 +5,29 @@
 use Carp;
 
 use base qw/App::CLI::Command Class::Accessor::Fast/;
-__PACKAGE__->mk_accessors(
-    qw/config name install_base build_base skip_test/ );
+__PACKAGE__->mk_accessors(qw/config name install_base build_base skip_test/);
 
 use BPB;
 
 sub options {
     (
-        'n|name=s'              => 'name',
-        'c|config=s'            => 'config',
+        'n|name=s'         => 'name',
+        'c|config=s'       => 'config',
         'i|install_base=s' => 'install_base',
-        'skip_test'             => 'skip_test',
+        'skip_test'        => 'skip_test',
     );
 }
 
 sub run {
-    my $self              = shift;
+    my $self         = shift;
     my $install_base = shift;
     $self->install_base($install_base) if $install_base;
 
+    die "need name arg" unless $self->name;
+
     my $bpb = BPB->new( config => $self->config, name => $self->name );
     $bpb->backend->export( target => $bpb->build->build_base );
-
-    # yeah, export's target is the source for build
-    $bpb->build->run( map { $_ => $self->$_ }
-          qw/install_base skip_test/ );
+    $bpb->build->run( map { $_ => $self->$_ } qw/install_base skip_test/ );
 }
 
 1;

Modified: bpsbuilder/BPB/lib/BPB/Script/Export.pm
==============================================================================
--- bpsbuilder/BPB/lib/BPB/Script/Export.pm	(original)
+++ bpsbuilder/BPB/lib/BPB/Script/Export.pm	Thu Dec 27 11:05:45 2007
@@ -21,6 +21,9 @@
     my $self   = shift;
     my $target = shift;
     $self->target($target) if $target;
+    for ( qw/name target/ ) {
+        die "need $_ arg" unless $self->$_();
+    }
     my $bpb = BPB->new( config => $self->config, name => $self->name );
     $bpb->backend->export( map { $_, $self->$_ } qw/target/ );
 }

Modified: bpsbuilder/BPB/lib/BPB/Script/Import.pm
==============================================================================
--- bpsbuilder/BPB/lib/BPB/Script/Import.pm	(original)
+++ bpsbuilder/BPB/lib/BPB/Script/Import.pm	Thu Dec 27 11:05:45 2007
@@ -32,6 +32,11 @@
     my $source = shift;
 
     $self->source($source) if $source;
+    
+    for ( qw/name source/ ) {
+        die "need $_ arg" unless $self->$_();
+    }
+
     my $bpb = BPB->new(
         config => $self->config,
         name   => $self->name,

Modified: bpsbuilder/BPB/lib/BPB/Script/Initialize.pm
==============================================================================
--- bpsbuilder/BPB/lib/BPB/Script/Initialize.pm	(original)
+++ bpsbuilder/BPB/lib/BPB/Script/Initialize.pm	Thu Dec 27 11:05:45 2007
@@ -22,6 +22,8 @@
     my $self = shift;
     my $name = shift;
     $self->name( $name ) if $name;
+    die 'need name arg' unless $self->name;
+
     my $bpb = BPB->new( config => $self->config, name => $self->name );
     $bpb->backend->initialize();
 }



More information about the Bps-public-commit mailing list