[Bps-public-commit] r10739 - Shipwright/lib/Shipwright/Script

sunnavy at bestpractical.com sunnavy at bestpractical.com
Wed Feb 6 17:46:34 EST 2008


Author: sunnavy
Date: Wed Feb  6 17:46:34 2008
New Revision: 10739

Modified:
   Shipwright/lib/Shipwright/Script/Import.pm

Log:
added overwrite and min-perl-version args for import

Modified: Shipwright/lib/Shipwright/Script/Import.pm
==============================================================================
--- Shipwright/lib/Shipwright/Script/Import.pm	(original)
+++ Shipwright/lib/Shipwright/Script/Import.pm	Wed Feb  6 17:46:34 2008
@@ -7,7 +7,7 @@
 use base qw/App::CLI::Command Class::Accessor::Fast/;
 __PACKAGE__->mk_accessors(
     qw/repository log_level comment source follow build_script require_yml
-      source_name test_script extra_tests/
+      source_name test_script extra_tests overwrite min_perl_version/
 );
 
 use Shipwright;
@@ -22,16 +22,18 @@
 
 sub options {
     (
-        'r|repository=s' => 'repository',
-        'l|log-level=s'  => 'log_level',
-        'm|comment=s'    => 'comment',
-        's|source=s'     => 'source',
-        'source-name=s'  => 'source_name',
-        'follow=s'      => 'follow',
-        'build-script=s' => 'build_script',
-        'require-yml=s'  => 'require_yml',
-        'test-script=s'  => 'test_script',
-        'extra-tests=s'  => 'extra_tests',
+        'r|repository=s'   => 'repository',
+        'l|log-level=s'    => 'log_level',
+        'm|comment=s'      => 'comment',
+        's|source=s'       => 'source',
+        'source-name=s'    => 'source_name',
+        'follow=s'         => 'follow',
+        'build-script=s'   => 'build_script',
+        'require-yml=s'    => 'require_yml',
+        'test-script=s'    => 'test_script',
+        'extra-tests=s'    => 'extra_tests',
+        'overwrite'        => 'overwrite',
+        'min-perl-version' => 'min_perl_version',
     );
 }
 
@@ -45,17 +47,27 @@
     my $source = shift;
 
     $self->source($source) if $source;
+    $self->follow( 1 ) unless defined $self->follow;
 
     for (qw/repository source/) {
         die "need $_ arg" unless $self->$_();
     }
 
+    unless ( $self->min_perl_version ) {
+        no warnings 'once';
+        require Config;
+        require version;
+        my $version = version->new( $Config::Config{version} );
+        $self->min_perl_version( $version->numify );
+    }
+
     my $shipwright = Shipwright->new(
-        repository  => $self->repository,
-        log_level   => $self->log_level,
-        source      => $self->source,
-        source_name => $self->source_name,
-        follow      => defined $self->follow ? $self->follow : 1,
+        repository       => $self->repository,
+        log_level        => $self->log_level,
+        source           => $self->source,
+        source_name      => $self->source_name,
+        follow           => $self->follow,
+        min_perl_version => $self->min_perl_version,
     );
 
     if ( $self->source ) {
@@ -86,13 +98,15 @@
         }
 
         $shipwright->backend->import(
-            source  => $self->source,
-            comment => $self->comment || 'import ' . $self->source,
+            source    => $self->source,
+            comment   => $self->comment || 'import ' . $self->source,
+            overwrite => $self->overwrite,
         );
         $shipwright->backend->import(
             source       => $self->source,
             comment      => 'import scripts for' . $self->source,
             build_script => $script_dir,
+            overwrite    => $self->overwrite,
         );
     }
 
@@ -161,13 +175,15 @@
                     $self->generate_build( $s, $script_dir, $shipwright );
 
                     $shipwright->backend->import(
-                        comment => 'deps for ' . $source,
-                        source  => $s,
+                        comment   => 'deps for ' . $source,
+                        source    => $s,
+                        overwrite => $self->overwrite,
                     );
                     $shipwright->backend->import(
                         source       => $s,
                         comment      => 'import scripts for' . $s,
                         build_script => $script_dir,
+                        overwrite    => $self->overwrite,
                     );
                 }
             }



More information about the Bps-public-commit mailing list