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

sunnavy at bestpractical.com sunnavy at bestpractical.com
Sat Dec 29 05:40:38 EST 2007


Author: sunnavy
Date: Sat Dec 29 05:40:38 2007
New Revision: 10178

Modified:
   bpsbuilder/BPB/lib/BPB/Script/Import.pm

Log:
move __require.yml to other dir, we can specify the file by set --require-yml arg

Modified: bpsbuilder/BPB/lib/BPB/Script/Import.pm
==============================================================================
--- bpsbuilder/BPB/lib/BPB/Script/Import.pm	(original)
+++ bpsbuilder/BPB/lib/BPB/Script/Import.pm	Sat Dec 29 05:40:38 2007
@@ -6,12 +6,12 @@
 
 use base qw/App::CLI::Command Class::Accessor::Fast/;
 __PACKAGE__->mk_accessors(
-    qw/config name comment source no_follow build_script/);
+    qw/config name comment source no_follow build_script require_yml/);
 
 use BPB;
 use File::Spec;
 use BPB::Config;
-use File::Copy qw/copy/;
+use File::Copy qw/copy move/;
 use File::Temp qw/tempdir/;
 
 sub options {
@@ -22,6 +22,7 @@
         's|source=s'     => 'source',
         'no-follow'      => 'no_follow',
         'build-script=s' => 'build_script',
+        'require-yml=s'  => 'require_yml',
     );
 }
 
@@ -32,8 +33,8 @@
     my $source = shift;
 
     $self->source($source) if $source;
-    
-    for ( qw/name source/ ) {
+
+    for (qw/name source/) {
         die "need $_ arg" unless $self->$_();
     }
 
@@ -44,7 +45,9 @@
         follow => !$self->no_follow,
     );
 
-    $self->source( $bpb->source->run );
+    $self->source( $bpb->source->run( '__require.yml' => $self->require_yml ) );
+
+    $self->import_req( $self->source, $bpb );
 
     my $script_dir = tempdir( CLEANUP => 1 );
 
@@ -56,7 +59,12 @@
         $self->generate_build( $self->source, $script_dir, $bpb );
     }
 
-    $self->import_req( $self->source, $bpb );
+    move(
+        File::Spec->catfile( $self->source, '__require.yml' ),
+        File::Spec->catfile( $script_dir,   'require.yml' )
+    );
+
+
     $bpb->backend->import( map { $_, $self->$_ } qw/comment source/ );
     $bpb->backend->import(
         source       => $self->source,
@@ -68,7 +76,7 @@
     my $self         = shift;
     my $source       = shift;
     my $bpb          = shift;
-    my $require_file = File::Spec->catfile( $source, '_require.yml' );
+    my $require_file = File::Spec->catfile( $source, '__require.yml' );
 
     my $dir = parent_dir($source);
 
@@ -96,14 +104,21 @@
                   . $self->source
                   unless $s;
                 $s = File::Spec->catfile( $dir, $s );
+
                 $self->import_req( $s, $bpb );
 
+                my $script_dir = tempdir( CLEANUP => 1 );
+                move(
+                    File::Spec->catfile( $s,          '__require.yml' ),
+                    File::Spec->catfile( $script_dir, 'require.yml' )
+                );
+
+                $self->generate_build( $s, $script_dir, $bpb );
+
                 $bpb->backend->import(
                     comment => 'deps for ' . $source,
                     source  => $s,
                 );
-                my $script_dir = tempdir( CLEANUP => 1 );
-                $self->generate_build( $s, $script_dir, $bpb );
                 $bpb->backend->import(
                     source       => $s,
                     build_script => $script_dir,
@@ -118,7 +133,7 @@
     my $self       = shift;
     my $source_dir = shift;
     my $script_dir = shift;
-    my $bpb = shift;
+    my $bpb        = shift;
 
     chdir $source_dir;
 
@@ -129,7 +144,7 @@
     }
     elsif ( -f 'Build.PL' ) {
         push @commands,
-        $bpb->build->perl .  ' Build.PL --install_base=%%INSTALL_BASE%%';
+          $bpb->build->perl . ' Build.PL --install_base=%%INSTALL_BASE%%';
         unless ( $bpb->build->skip_test ) {
             push @commands, "./Build test";
         }



More information about the Bps-public-commit mailing list