[Bps-public-commit] r11114 - in Shipwright/trunk: lib/Shipwright/Script share/bin

sunnavy at bestpractical.com sunnavy at bestpractical.com
Wed Mar 19 03:32:59 EDT 2008


Author: sunnavy
Date: Wed Mar 19 03:32:59 2008
New Revision: 11114

Modified:
   Shipwright/trunk/lib/Shipwright/Build.pm
   Shipwright/trunk/lib/Shipwright/Script/Build.pm
   Shipwright/trunk/share/bin/shipwright-builder

Log:
added name arg in build for a better named install_base if it's not specified

Modified: Shipwright/trunk/lib/Shipwright/Build.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Build.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Build.pm	Wed Mar 19 03:32:59 2008
@@ -8,7 +8,7 @@
 
 __PACKAGE__->mk_accessors(
     qw/install_base perl build_base skip_test commands log
-      skip only_test force order flags/
+      skip only_test force order flags name/
 );
 
 use File::Spec;
@@ -33,7 +33,9 @@
       File::Spec->catfile( tempdir( CLEANUP => 0 ), 'build' );
 
     unless ( $self->install_base ) {
-        $self->install_base( tempdir( CLEANUP => 0 ) );
+
+        my $dir = tempdir( $self->name . '-XXXXXX', DIR => File::Spec->tmpdir );
+        $self->install_base( File::Spec->catfile( $dir, $self->name ) );
     }
 
     no warnings 'uninitialized';

Modified: Shipwright/trunk/lib/Shipwright/Script/Build.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Script/Build.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Script/Build.pm	Wed Mar 19 03:32:59 2008
@@ -7,7 +7,7 @@
 use base qw/App::CLI::Command Class::Accessor::Fast Shipwright::Script/;
 __PACKAGE__->mk_accessors(
     qw/repository log_level install_base build_base skip skip_test only_test
-      force log_file flags/
+      force log_file flags name/
 );
 
 use Shipwright;
@@ -21,6 +21,7 @@
         'l|log-level=s'  => 'log_level',
         'log-file=s'     => 'log_file',
         'install-base=s' => 'install_base',
+        'name=s'         => 'name',
         'skip=s'         => 'skip',
         'flags=s'        => 'flags',
         'skip-test'      => 'skip_test',
@@ -40,6 +41,10 @@
 
     die "need repository arg" unless $self->repository;
 
+    if ( ! $self->name && $self->repository =~ /([-.\w]+)$/ ) {
+        $self->name( $1 );
+    }
+
     $self->skip( { map { $_ => 1 } split /\s*,\s*/, $self->skip || '' } );
     $self->flags(
         {
@@ -54,6 +59,7 @@
         log_file   => $self->log_file,
         skip       => $self->skip,
         flags      => $self->flags,
+        name       => $self->name,
     );
 
     $shipwright->backend->export( target => $shipwright->build->build_base );
@@ -81,6 +87,8 @@
    --skip             specify dists which'll be skipped
    --skip-test        specify whether to skip test
    --only-test        just test(the running script is t/test)
+   --flags            specify flags
+   --name             specify the name of the project
 
 =head1 AUTHOR
 

Modified: Shipwright/trunk/share/bin/shipwright-builder
==============================================================================
--- Shipwright/trunk/share/bin/shipwright-builder	(original)
+++ Shipwright/trunk/share/bin/shipwright-builder	Wed Mar 19 03:32:59 2008
@@ -17,7 +17,7 @@
 GetOptions(
     \%args,  'install-base=s', 'perl=s',    'skip=s',
     'flags=s', 'skip-test',      'only-test', 'force',
-    'clean', 'project-name',   'help',
+    'clean', 'name=s',   'help',
 );
 
 my $USAGE = <<'END'
@@ -31,6 +31,10 @@
     defaults: a temp dir below your system's tmp.
     e.g. --install-base /home/local/mydist
 
+name: the name of the vessel. used to create a better named dir if
+    install_base is not supplied
+    e.g. --name mydist
+
 perl: which perl to use for the to be installed dists. 
     defaults: if we have perl in the source, it will use that one.
               else, it will use the one which runs this builder script.
@@ -112,12 +116,12 @@
         $CPAN::Config->{prerequisites_policy} = 'ignore';
     }
 
-    my $project_name = $args{'project-name'};
-    ($project_name) = $build_base =~ /([-.\w]+)$/ unless $project_name;
+    my $name = $args{'name'};
+    ($name) = $build_base =~ /([-.\w]+)$/ unless $name;
 
     unless ( $args{'install-base'} ) {
-        my $dir = tempdir( $project_name . '-XXXXXX', DIR => '/tmp' );
-        $args{'install-base'} = File::Spec->catfile( $dir, $project_name );
+        my $dir = tempdir( $name . '-XXXXXX', DIR => File::Spec->tmpdir );
+        $args{'install-base'} = File::Spec->catfile( $dir, $name );
 
         print $log
           "no default install-base, will set it to $args{'install-base'}\n";



More information about the Bps-public-commit mailing list