[Bps-public-commit] r9970 - bpsbuilder/BPB/lib/BPB/Script
sunnavy at bestpractical.com
sunnavy at bestpractical.com
Mon Dec 17 03:35:50 EST 2007
Author: sunnavy
Date: Mon Dec 17 03:35:50 2007
New Revision: 9970
Modified:
bpsbuilder/BPB/lib/BPB/Script/Import.pm
Log:
added biild-script args for import
Modified: bpsbuilder/BPB/lib/BPB/Script/Import.pm
==============================================================================
--- bpsbuilder/BPB/lib/BPB/Script/Import.pm (original)
+++ bpsbuilder/BPB/lib/BPB/Script/Import.pm Mon Dec 17 03:35:50 2007
@@ -5,19 +5,22 @@
use Carp;
use base qw/App::CLI::Command Class::Accessor::Fast/;
-__PACKAGE__->mk_accessors(qw/config name comment source no_follow/);
+__PACKAGE__->mk_accessors(
+ qw/config name comment source no_follow build_script/);
use BPB;
use File::Spec;
use BPB::Config;
+use File::Copy qw/copy/;
sub options {
(
- 'c|config=s' => 'config',
- 'n|name=s' => 'name',
- 'm|comment=s' => 'comment',
- 's|source=s' => 'source',
- 'no-follow' => 'no_follow',
+ 'c|config=s' => 'config',
+ 'n|name=s' => 'name',
+ 'm|comment=s' => 'comment',
+ 's|source=s' => 'source',
+ 'no-follow' => 'no_follow',
+ 'build-script=s' => 'build_script',
);
}
@@ -32,25 +35,27 @@
config => $self->config,
name => $self->name,
source => $self->source,
- follow => ! $self->no_follow,
+ follow => !$self->no_follow,
);
- $self->source($bpb->source->run);
+ $self->source( $bpb->source->run );
+
+ copy( $self->build_script, File::Spec->catfile( $self->source, '_build' ))
+ if $self->build_script;
$self->import_req( $self->source, $bpb );
$bpb->backend->import( map { $_, $self->$_ } qw/comment source/ );
}
-
sub import_req {
my $self = shift;
my $source = shift;
my $bpb = shift;
my $require_file = File::Spec->catfile( $source, '_require.yml' );
- my $dir = parent_dir( $source );
+ my $dir = parent_dir($source);
- my $map_file = File::Spec->catfile( $dir, 'map.yml' );
+ my $map_file = File::Spec->catfile( $dir, 'map.yml' );
if ( -e $require_file ) {
my $req = BPB::Config::LoadFile($require_file);
@@ -60,7 +65,7 @@
$map = BPB::Config::LoadFile($map_file);
}
- opendir my( $d ), $dir;
+ opendir my ($d), $dir;
my @sources = readdir $d;
close $d;
@@ -86,12 +91,11 @@
}
-
sub parent_dir {
my $source = shift;
- my @dirs = File::Spec->splitdir( $source );
+ my @dirs = File::Spec->splitdir($source);
pop @dirs;
- return File::Spec->catfile( @dirs );
+ return File::Spec->catfile(@dirs);
}
1;
More information about the Bps-public-commit
mailing list