[Bps-public-commit] r13611 - in Shipwright/trunk: lib/Shipwright/Script

sunnavy at bestpractical.com sunnavy at bestpractical.com
Thu Jun 26 14:58:33 EDT 2008


Author: sunnavy
Date: Thu Jun 26 14:58:31 2008
New Revision: 13611

Modified:
   Shipwright/trunk/   (props changed)
   Shipwright/trunk/lib/Shipwright/Script/Update.pm

Log:
 r13836 at sunnavys-mb:  sunnavy | 2008-06-27 02:33:54 +0800
 added version support for update cmd


Modified: Shipwright/trunk/lib/Shipwright/Script/Update.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Script/Update.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Script/Update.pm	Thu Jun 26 14:58:31 2008
@@ -6,7 +6,7 @@
 
 use base qw/App::CLI::Command Class::Accessor::Fast Shipwright::Script/;
 __PACKAGE__->mk_accessors(
-    qw/repository log_level name all follow log_file builder utility/);
+    qw/repository log_level name all follow log_file builder utility version/);
 
 use Shipwright;
 use File::Spec;
@@ -28,6 +28,7 @@
         'follow'         => 'follow',
         'builder'        => 'builder',
         'utility'        => 'utility',
+        'version=s'        => 'version',
     );
 }
 
@@ -37,9 +38,7 @@
     my $self = shift;
     my $name = shift;
 
-    $shipwright = Shipwright->new(
-        repository => $self->repository,
-    );
+    $shipwright = Shipwright->new( repository => $self->repository, );
 
     if ( $self->builder ) {
         $shipwright->backend->update(
@@ -93,9 +92,8 @@
                 $find_deps->( $self->name );
                 @dists = keys %checked;
             }
-            for ( @dists, $self->name ) {
-                $self->_update($_);
-            }
+            $self->_update($_) for @dists;
+            $self->_update( $self->name, $self->version );
         }
     }
 
@@ -103,15 +101,16 @@
 }
 
 sub _update {
-    my $self = shift;
-    my $name = shift;
-
+    my $self    = shift;
+    my $name    = shift;
+    my $version = shift;
     if ( $source->{$name} ) {
         $shipwright->source(
             Shipwright::Source->new(
                 name   => $name,
                 source => $source->{$name},
                 follow => 0,
+                version => $version,
             )
         );
     }
@@ -135,13 +134,14 @@
             Shipwright::Source->new(
                 source => "cpan:$s",
                 follow => 0,
+                version => $version,
             )
         );
     }
 
     $shipwright->source->run;
 
-    my $version =
+    $version =
       Shipwright::Util::LoadFile( $shipwright->source->version_path );
 
     $shipwright->backend->import(
@@ -174,7 +174,8 @@
  -l [--log-level] LOGLEVEL    : specify the log level
                                 (info, debug, warn, error, or fatal)
  --log-file FILENAME          : specify the log file
- --name NAME                  : specify the name of the project
+ --name NAME                  : specify the dist name to be updated
+ --version                    : specify the version of the dist
  --all                        : update all dists
  --follow                     : update one dist with all its dependencies
  --builder                    : update bin/shipwright-builder



More information about the Bps-public-commit mailing list