[Bps-public-commit] r10156 - bpsbuilder/BPB/lib

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


Author: sunnavy
Date: Thu Dec 27 11:11:22 2007
New Revision: 10156

Modified:
   bpsbuilder/BPB/lib/BPB.pm

Log:
we init backend, source and build only if we get a valid name specified

Modified: bpsbuilder/BPB/lib/BPB.pm
==============================================================================
--- bpsbuilder/BPB/lib/BPB.pm	(original)
+++ bpsbuilder/BPB/lib/BPB.pm	Thu Dec 27 11:11:22 2007
@@ -23,7 +23,6 @@
     my $class = shift;
 
     my %args = @_;
-    croak "need name option" unless $args{name};
 
     unless ( $args{config} ) {
         require File::Spec;
@@ -39,23 +38,24 @@
         BPB::Config->new( config => delete $args{config}, name => $args{name} )
     );
 
-    die "invalid project name $args{name}"
-      unless ref $self->config->name eq 'HASH';
-    $self->backend(
-        BPB::Backend->new(
-            %{ $self->config->name->{backend} },
-            name => $args{name}
-        )
-    );
-    $self->source(
-        BPB::Source->new(
-            %{ $self->config->name->{source} },
-            follow => $args{follow},
-            source => $args{source},
-        )
-    ) if $args{source};
+    if ( $self->config->name ) {
+
+        $self->backend(
+            BPB::Backend->new(
+                %{ $self->config->name->{backend} },
+                name => $args{name}
+            )
+        );
+        $self->source(
+            BPB::Source->new(
+                %{ $self->config->name->{source} },
+                follow => $args{follow},
+                source => $args{source},
+            )
+        ) if $args{source};
 
-    $self->build( BPB::Build->new( %{ $self->config->name->{build} } ) );
+        $self->build( BPB::Build->new( %{ $self->config->name->{build} } ) );
+    }
 
     return $self;
 }



More information about the Bps-public-commit mailing list