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

sunnavy at bestpractical.com sunnavy at bestpractical.com
Tue May 13 13:14:09 EDT 2008


Author: sunnavy
Date: Tue May 13 13:14:03 2008
New Revision: 12303

Modified:
   Shipwright/trunk/   (props changed)
   Shipwright/trunk/lib/Shipwright/Script/Build.pm
   Shipwright/trunk/lib/Shipwright/Script/Create.pm
   Shipwright/trunk/lib/Shipwright/Script/Flags.pm
   Shipwright/trunk/lib/Shipwright/Script/Import.pm
   Shipwright/trunk/lib/Shipwright/Script/List.pm
   Shipwright/trunk/lib/Shipwright/Script/Maintain.pm
   Shipwright/trunk/lib/Shipwright/Script/Update.pm

Log:
 r12350 at sunnavys-mb:  sunnavy | 2008-05-14 01:03:02 +0800
 prefix all methods except run and options with '_', also fix docs there so some won't show up when exec help


Modified: Shipwright/trunk/lib/Shipwright/Script/Build.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Script/Build.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Script/Build.pm	Tue May 13 13:14:03 2008
@@ -12,9 +12,6 @@
 
 use Shipwright;
 
-=head2 options
-=cut
-
 sub options {
     (
         'r|repository=s' => 'repository',
@@ -31,9 +28,6 @@
     );
 }
 
-=head2 run
-=cut
-
 sub run {
     my $self         = shift;
     my $install_base = shift;

Modified: Shipwright/trunk/lib/Shipwright/Script/Create.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Script/Create.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Script/Create.pm	Tue May 13 13:14:03 2008
@@ -11,9 +11,6 @@
 use File::Spec;
 use Shipwright::Util;
 
-=head2 options
-=cut
-
 sub options {
     (
         'r|repository=s' => 'repository',
@@ -22,9 +19,6 @@
     );
 }
 
-=head2 run
-=cut
-
 sub run {
     my $self       = shift;
     

Modified: Shipwright/trunk/lib/Shipwright/Script/Flags.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Script/Flags.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Script/Flags.pm	Tue May 13 13:14:03 2008
@@ -11,9 +11,6 @@
 use Shipwright;
 use List::MoreUtils qw/uniq/;
 
-=head2 options
-=cut
-
 sub options {
     (
         'r|repository=s' => 'repository',
@@ -26,9 +23,6 @@
     );
 }
 
-=head2 run
-=cut
-
 sub run {
     my $self = shift;
     my $dist = shift;

Modified: Shipwright/trunk/lib/Shipwright/Script/Import.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Script/Import.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Script/Import.pm	Tue May 13 13:14:03 2008
@@ -22,9 +22,6 @@
 
 Hash::Merge::set_behavior('RIGHT_PRECEDENT');
 
-=head2 options
-=cut
-
 sub options {
     (
         'r|repository=s'   => 'repository',
@@ -47,9 +44,6 @@
 
 my ( %imported, $version );
 
-=head2 run
-=cut
-
 sub run {
     my $self   = shift;
     my $source = shift;
@@ -120,11 +114,11 @@
                 File::Spec->catfile( $script_dir, 'build' ) );
         }
         else {
-            $self->generate_build( $self->source, $script_dir, $shipwright );
+            $self->_generate_build( $self->source, $script_dir, $shipwright );
         }
 
         if ( $self->follow ) {
-            $self->import_req( $self->source, $shipwright );
+            $self->_import_req( $self->source, $shipwright );
 
             move(
                 File::Spec->catfile( $self->source, '__require.yml' ),
@@ -159,7 +153,7 @@
             Hash::Merge::merge( $shipwright->backend->source || {}, $new_url )
         );
 
-        reorder($shipwright);
+        $self->_reorder($shipwright);
     }
 
     # import tests
@@ -179,19 +173,15 @@
 
 }
 
-=head2 import_req
-
-import required dists for a dist
+# _import_req: import required dists for a dist
 
-=cut
-
-sub import_req {
+sub _import_req {
     my $self         = shift;
     my $source       = shift;
     my $shipwright   = shift;
     my $require_file = File::Spec->catfile( $source, '__require.yml' );
 
-    my $dir = parent_dir($source);
+    my $dir = $self->_parent_dir($source);
 
     my $map_file = File::Spec->catfile( $dir, 'map.yml' );
 
@@ -225,7 +215,7 @@
 
                     $s = File::Spec->catfile( $dir, $s );
 
-                    $self->import_req( $s, $shipwright );
+                    $self->_import_req( $s, $shipwright );
 
                     my $script_dir = tempdir( CLEANUP => 1 );
                     move(
@@ -233,7 +223,7 @@
                         File::Spec->catfile( $script_dir, 'require.yml' )
                     ) or die "move $s/__require.yml failed: $!";
 
-                    $self->generate_build( $s, $script_dir, $shipwright );
+                    $self->_generate_build( $s, $script_dir, $shipwright );
 
                     $shipwright->backend->import(
                         comment   => 'deps for ' . $source,
@@ -254,13 +244,10 @@
 
 }
 
-=head2 generate_build
-
-automatically generate build script if not provided
+# _generate_build:
+# automatically generate build script if not provided
 
-=cut
-
-sub generate_build {
+sub _generate_build {
     my $self       = shift;
     my $source_dir = shift;
     my $script_dir = shift;
@@ -305,27 +292,22 @@
     close $fh;
 }
 
-=head2 parent_dir
-
-return parent dir 
-
-=cut
+# _parent_dir: return parent dir
 
-sub parent_dir {
+sub _parent_dir {
+    my $self = shift;
     my $source = shift;
     my @dirs   = File::Spec->splitdir($source);
     pop @dirs;
     return File::Spec->catfile(@dirs);
 }
 
-=head2 reorder
-
-make some hack for order.
-move ExtUtils::MakeMaker and Module::Build to the head of cpan dists
-
-=cut
+# _reorder:
+# make some hack for order.
+# move ExtUtils::MakeMaker and Module::Build to the head of cpan dists
 
-sub reorder {
+sub _reorder {
+    my $self = shift;
     my $shipwright = shift;
     my $order      = $shipwright->backend->order;
 

Modified: Shipwright/trunk/lib/Shipwright/Script/List.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Script/List.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Script/List.pm	Tue May 13 13:14:03 2008
@@ -9,10 +9,6 @@
     qw/repository log_level log_file dist with_latest_version only_update/);
 
 use Shipwright;
-use Data::Dumper;
-
-=head2 options
-=cut
 
 sub options {
     (
@@ -25,9 +21,6 @@
     );
 }
 
-=head2 run
-=cut
-
 sub run {
     my $self = shift;
     my $dist = shift;

Modified: Shipwright/trunk/lib/Shipwright/Script/Maintain.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Script/Maintain.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Script/Maintain.pm	Tue May 13 13:14:03 2008
@@ -12,9 +12,6 @@
 
 use Shipwright;
 
-=head2 options
-=cut
-
 sub options {
     (
         'r|repository=s'        => 'repository',
@@ -28,9 +25,6 @@
     );
 }
 
-=head2 run
-=cut
-
 sub run {
     my $self = shift;
 

Modified: Shipwright/trunk/lib/Shipwright/Script/Update.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Script/Update.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Script/Update.pm	Tue May 13 13:14:03 2008
@@ -17,9 +17,6 @@
 
 Hash::Merge::set_behavior('RIGHT_PRECEDENT');
 
-=head2 options
-=cut
-
 sub options {
     (
         'r|repository=s' => 'repository',
@@ -33,8 +30,6 @@
 
 my ( $shipwright, $map, $source );
 
-=head2 run
-=cut
 
 sub run {
     my $self = shift;
@@ -56,7 +51,7 @@
     if ( $self->all ) {
         my $dists = $shipwright->backend->order || [];
         for (@$dists) {
-            update($_);
+            $self->_update($_);
         }
     }
     else {
@@ -85,15 +80,13 @@
             @dists = keys %checked;
         }
         for ( @dists, $self->name ) {
-            update($_);
+            $self->_update($_);
         }
     }
 }
 
-=head2 update
-=cut
-
-sub update {
+sub _update {
+    my $self = shift;
     my $name = shift;
 
     if ( $source->{$name} ) {



More information about the Bps-public-commit mailing list