Show
Ignore:
Timestamp:
12/28/07 11:23:49 (13 months ago)
Author:
tokuhirom
Message:

r3854@mnk (orig r504): tokuhiro | 2007-08-03 22:03:01 -0700
apply the franck patch.thanks franck++.
added configmaker & recipe.


Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/Archer/archer.pl

    r3683 r3707  
    77use FindBin (); 
    88use Path::Class; 
     9use File::Util; 
     10use Cwd; 
    911 
    10 use lib dir($FindBin::RealBin, 'lib')->stringify; 
     12use lib dir( $FindBin::RealBin, 'lib' )->stringify; 
    1113 
    1214use Archer; 
     
    1416my $argv_str = "@ARGV"; 
    1517my $fork_num = 1; 
    16 my $config = file($FindBin::RealBin, 'config.yaml')->stringify; 
     18my $config   = file( $FindBin::RealBin, 'config.yaml' )->stringify; 
    1719Getopt::Long::GetOptions( 
    18     '--para=i'         => \$fork_num, 
    19     '--dry-run'        => \my $dry_run_fg, 
    20     '--skip=s'         => \my $skips, 
    21     '--shell',         => \my $shell, 
    22     '--man'            => \my $man, 
    23     '--config=s'       => \$config, 
    24   ) 
    25   or pod2usage(2); 
    26 Getopt::Long::Configure("bundling");    # allows -p 
    27 pod2usage(-verbose => 2) if $man; 
    28 pod2usage(2) unless @ARGV; 
     20    '--para=i'       => \$fork_num, 
     21    '--dry-run'      => \my $dry_run_fg, 
     22    '--skip=s'       => \my $skips, 
     23    '--shell',       => \my $shell, 
     24    '--man'          => \my $man, 
     25    '--config=s'     => \$config, 
     26    '--write-config' => \my $wc, 
     27) or pod2usage( 2 ); 
     28Getopt::Long::Configure( "bundling" );    # allows -p 
     29pod2usage( -verbose => 2 ) if $man; 
    2930 
    30 for my $proj (@ARGV) { 
     31if ( !@ARGV ) { 
     32 
     33    # name of the current dir, will be the project name 
     34    my $dir     = getcwd; 
     35    my $f       = File::Util->new; 
     36    my $project = $f->strip_path( $dir ); 
     37    $config = '.archer.yaml'; 
     38    if ( $f->existent( $config ) ) { 
     39        Archer->new( 
     40            {   project      => $project, 
     41                dry_run_fg   => $dry_run_fg, 
     42                parallel_num => $fork_num, 
     43                skips => +{ map { $_ => 1 } split /,/, ( $skips || '' ) }, 
     44                config_yaml => $config, 
     45                argv_str    => $argv_str, 
     46                shell       => $shell, 
     47            } 
     48        )->run; 
     49        exit; 
     50    } 
     51    else { 
     52        Archer->new( 
     53            {   project      => $project, 
     54                dry_run_fg   => $dry_run_fg, 
     55                config_yaml  => $config, 
     56                write_config => $wc, 
     57            } 
     58        )->run; 
     59        exit; 
     60    } 
     61    pod2usage( 2 ) unless @ARGV; 
     62} 
     63 
     64for my $proj ( @ARGV ) { 
    3165    Archer->new( 
    32         { 
    33             project        => $proj, 
    34             dry_run_fg     => $dry_run_fg, 
    35             parallel_num   => $fork_num, 
    36             skips          => +{ map { $_ => 1 } split /,/, ($skips || '')}, 
    37             config_yaml    => $config, 
    38             argv_str       => $argv_str, 
    39             shell          => $shell, 
     66        {   project      => $proj, 
     67            dry_run_fg   => $dry_run_fg, 
     68            parallel_num => $fork_num, 
     69            skips        => +{ map { $_ => 1 } split /,/, ( $skips || '' ) }, 
     70            config_yaml  => $config, 
     71            argv_str     => $argv_str, 
     72            shell        => $shell, 
     73            write_config => $wc, 
    4074        } 
    4175    )->run;