[Bps-public-commit] r13673 - in Shipwright/trunk: . lib/Shipwright/Backend lib/Shipwright/Script

sunnavy at bestpractical.com sunnavy at bestpractical.com
Fri Jun 27 22:28:20 EDT 2008


Author: sunnavy
Date: Fri Jun 27 22:28:20 2008
New Revision: 13673

Modified:
   Shipwright/trunk/   (props changed)
   Shipwright/trunk/lib/Shipwright/Backend.pm
   Shipwright/trunk/lib/Shipwright/Backend/Base.pm
   Shipwright/trunk/lib/Shipwright/Backend/FS.pm
   Shipwright/trunk/lib/Shipwright/Backend/SVK.pm
   Shipwright/trunk/lib/Shipwright/Backend/SVN.pm
   Shipwright/trunk/lib/Shipwright/Script/Import.pm

Log:
 r13922 at sunnavys-mb:  sunnavy | 2008-06-28 10:14:28 +0800
 cleaned up, refacotr a bit, removed propset method, which is useless now


Modified: Shipwright/trunk/lib/Shipwright/Backend.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Backend.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Backend.pm	Fri Jun 27 22:28:20 2008
@@ -88,8 +88,6 @@
 
 =head2 info
 
-=head2 propset
-
 =head2 test_script
 
 =head2 requires

Modified: Shipwright/trunk/lib/Shipwright/Backend/Base.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Backend/Base.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Backend/Base.pm	Fri Jun 27 22:28:20 2008
@@ -86,14 +86,14 @@
 
     unless ( $args{_initialize} || $args{_extra_tests} ) {
         if ( $args{_extra_tests} ) {
-            $self->delete( path => "t/extra" ) if $args{delete};
+            $self->delete( path => "/t/extra" ) if $args{delete};
 
             $self->log->info( "import extra tests to " . $self->repository );
             Shipwright::Util->run(
                 $self->_cmd( import => %args, name => $name ) );
         }
         elsif ( $args{build_script} ) {
-            if ( $self->info( path => "scripts/$name" )
+            if ( $self->info( path => "/scripts/$name" )
                 && not $args{overwrite} )
             {
                 $self->log->warn(
@@ -101,7 +101,7 @@
                 );
             }
             else {
-                $self->delete( path =>  "scripts/$name" ) if $args{delete};
+                $self->delete( path =>  "/scripts/$name" ) if $args{delete};
 
                 $self->log->info(
                     "import $args{source}'s scripts to " . $self->repository );
@@ -110,14 +110,14 @@
             }
         }
         else {
-            if ( $self->info( path => "dists/$name" ) && not $args{overwrite} )
+            if ( $self->info( path => "/dists/$name" ) && not $args{overwrite} )
             {
                 $self->log->warn(
 "path dists/$name alreay exists, need to set overwrite arg to overwrite"
                 );
             }
             else {
-                $self->delete( path =>  "dists/$name" ) if $args{delete};
+                $self->delete( path =>  "/dists/$name" ) if $args{delete};
                 $self->log->info(
                     "import $args{source} to " . $self->repository );
                 $self->_add_to_order($name);
@@ -177,8 +177,6 @@
 }
 
 
-# add a dist to order
-
 sub _add_to_order {
     my $self = shift;
     my $name = shift;
@@ -284,7 +282,7 @@
 sub order {
     my $self  = shift;
     my $order = shift;
-    my $path  = File::Spec->catfile( 'shipwright', 'order.yml' );
+    my $path  = '/shipwright/order.yml';
     return $self->_yml( $path, $order );
 }
 
@@ -298,7 +296,7 @@
     my $self = shift;
     my $map  = shift;
 
-    my $path = File::Spec->catfile( 'shipwright', 'map.yml' );
+    my $path = '/shipwright/map.yml';
     return $self->_yml( $path, $map );
 }
 
@@ -311,7 +309,7 @@
 sub source {
     my $self   = shift;
     my $source = shift;
-    my $path   = File::Spec->catfile( 'shipwright', 'source.yml' );
+    my $path = '/shipwright/source.yml';
     return $self->_yml( $path, $source );
 }
 
@@ -325,7 +323,7 @@
     my $self  = shift;
     my $flags = shift;
 
-    my $path = File::Spec->catfile( 'shipwright', 'flags.yml' );
+    my $path = '/shipwright/flags.yml';
     return $self->_yml( $path, $flags );
 }
 
@@ -339,7 +337,7 @@
     my $self    = shift;
     my $version = shift;
 
-    my $path = File::Spec->catfile( 'shipwright', 'version.yml' );
+    my $path = '/shipwright/version.yml';
     return $self->_yml( $path, $version );
 }
 
@@ -352,7 +350,7 @@
 sub ktf {
     my $self = shift;
     my $ktf  = shift;
-    my $path = File::Spec->catfile( 'shipwright', 'ktf.yml' );
+    my $path = '/shipwright/ktf.yml';
 
     return $self->_yml( $path, $ktf );
 }
@@ -367,7 +365,7 @@
     my %args = @_;
     my $path = $args{path} || '';
     if ( $self->info( path => $path ) ) {
-        $self->log->info( "delete " . $self->repository . "/$path" );
+        $self->log->info( "delete " . $self->repository . $path );
         Shipwright::Util->run( $self->_cmd( delete => path => $path ), 1 );
     }
 }
@@ -471,8 +469,8 @@
     }
     else {
 
-        # every valid shipwright repo has 'shipwright' subdir;
-        my $info = $self->info( path => 'shipwright' );
+        # every valid shipwright repo has '/shipwright' subdir;
+        my $info = $self->info( path => '/shipwright' );
 
         return 1 if $info;
     }
@@ -495,8 +493,6 @@
       unless -e File::Spec->catfile( Shipwright::Util->share_root,
         $args{path} );
 
-    $args{path} = '/' . $args{path} unless $args{path} =~ m{^/};
-
     return $self->_update_file( $args{path},
         File::Spec->catfile( Shipwright::Util->share_root, $args{path} ) );
 }
@@ -519,7 +515,6 @@
     }
 }
 
-#*_cmd = *propset = *_subclass_method;
 *_cmd = *_update_file = *_subclass_method;
 
 =back

Modified: Shipwright/trunk/lib/Shipwright/Backend/FS.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Backend/FS.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Backend/FS.pm	Fri Jun 27 22:28:20 2008
@@ -60,7 +60,7 @@
         if ( $args{_extra_tests} ) {
             $cmd = [
                 'cp', '-r',
-                $args{source}, join( '/', $self->repository, 't', 'extra' ),
+                $args{source}, $self->repository . '/t/extra'
             ];
         }
         else {
@@ -79,17 +79,17 @@
         }
     }
     elsif ( $type eq 'delete' ) {
-        $cmd = [ 'rm', '-rf', join '/', $self->repository, $args{path}, ];
+        $cmd = [ 'rm', '-rf', $self->repository . $args{path}, ];
     }
     elsif ( $type eq 'move' ) {
         $cmd = [
             'mv',
-            join( '/', $self->repository, $args{path} ),
-            join( '/', $self->repository, $args{new_path} )
+            $self->repository . $args{path},
+            $self->repository . $args{new_path}
         ];
     }
     elsif ( $type eq 'info' || $type eq 'list' ) {
-        $cmd = [ 'ls', join '/', $self->repository, $args{path} ];
+        $cmd = [ 'ls', $self->repository . $args{path} ];
     }
     else {
         croak "invalid command: $type";

Modified: Shipwright/trunk/lib/Shipwright/Backend/SVK.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Backend/SVK.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Backend/SVK.pm	Fri Jun 27 22:28:20 2008
@@ -87,7 +87,7 @@
         elsif ( $args{_extra_tests} ) {
             $cmd = [
                 'svk', 'import',
-                $args{source}, join( '/', $self->repository, 't', 'extra' ),
+                $args{source}, $self->repository . '/t/extra',
                 '-m', q{'} . $args{comment} . q{'},
             ];
         }
@@ -115,7 +115,7 @@
     elsif ( $type eq 'delete' ) {
         $cmd = [
             'svk', 'delete', '-m', q{'} . 'delete repository' . q{'},
-            join '/', $self->repository, $args{path},
+            $self->repository . $args{path},
         ];
     }
     elsif ( $type eq 'move' ) {
@@ -124,24 +124,15 @@
             'move',
             '-m',
             q{'} . "move $args{path} to $args{new_path}" . q{'},
-            join( '/', $self->repository, $args{path} ),
-            join( '/', $self->repository, $args{new_path} )
+            $self->repository . $args{path},
+            $self->repository . $args{new_path}
         ];
     }
     elsif ( $type eq 'info' ) {
-        $cmd = [ 'svk', 'info', join '/', $self->repository, $args{path} ];
+        $cmd = [ 'svk', 'info', $self->repository . $args{path} ];
     }
     elsif ( $type eq 'cat' ) {
-        $cmd = [ 'svk', 'cat', join '/', $self->repository, $args{path} ];
-    }
-    elsif ( $type eq 'propset' ) {
-        $cmd = [
-            'svk',                                'propset',
-            $args{type},                          '-m',
-            q{'} . "set prop $args{type}" . q{'}, q{'} . $args{value} . q{'},
-            join '/',                             $self->repository,
-            $args{path}
-        ];
+        $cmd = [ 'svk', 'cat', $self->repository . $args{path} ];
     }
     else {
         croak "invalid command: $type";
@@ -195,20 +186,6 @@
     }
 }
 
-=item propset
-
-A wrapper around svk's propset command.
-
-=cut
-
-sub propset {
-    my $self = shift;
-    my %args = @_;
-    my ( $info, $err ) =
-      Shipwright::Util->run( $self->_cmd( propset => %args ) );
-    $self->log->warn($err) if $err;
-}
-
 =item check_repository
 
 Check if the given repository is valid.

Modified: Shipwright/trunk/lib/Shipwright/Backend/SVN.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Backend/SVN.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Backend/SVN.pm	Fri Jun 27 22:28:20 2008
@@ -86,7 +86,7 @@
         elsif ( $args{_extra_tests} ) {
             $cmd = [
                 'svn', 'import',
-                $args{source}, join( '/', $self->repository, 't', 'extra' ),
+                $args{source}, $self->repository . 't/extra',
                 '-m', q{'} . $args{comment} . q{'},
             ];
         }
@@ -117,7 +117,7 @@
     elsif ( $type eq 'delete' ) {
         $cmd = [
             'svn', 'delete', '-m', q{'} . 'delete' . $args{path} . q{'},
-            join '/', $self->repository, $args{path}
+            $self->repository . $args{path}
         ];
     }
     elsif ( $type eq 'move' ) {
@@ -126,22 +126,15 @@
             'move',
             '-m',
             q{'} . "move $args{path} to $args{new_path}" . q{'},
-            join( '/', $self->repository, $args{path} ),
-            join( '/', $self->repository, $args{new_path} )
+            $self->repository . $args{path},
+            $self->repository . $args{new_path}
         ];
     }
     elsif ( $type eq 'info' ) {
-        $cmd = [ 'svn', 'info', join '/', $self->repository, $args{path} ];
+        $cmd = [ 'svn', 'info', $self->repository . $args{path} ];
     }
     elsif ( $type eq 'cat' ) {
-        $cmd = [ 'svn', 'cat', join '/', $self->repository, $args{path} ];
-    }
-    elsif ( $type eq 'propset' ) {
-        $cmd = [
-            'svn',       'propset',
-            $args{type}, q{'} . $args{value} . q{'},
-            $args{path}
-        ];
+        $cmd = [ 'svn', 'cat', $self->repository . $args{path} ];
     }
     else {
         croak "invalid command: $type";
@@ -205,31 +198,6 @@
     }
 }
 
-=item propset
-
-A wrapper around svn's propset command.
-
-=cut
-
-sub propset {
-    my $self = shift;
-    my %args = @_;
-    my $dir  = tempdir( CLEANUP => 1 );
-
-    $self->checkout( target => $dir, );
-    Shipwright::Util->run(
-        $self->_cmd(
-            propset => %args,
-            path => File::Spec->catfile( $dir, $args{path} )
-        )
-    );
-
-    $self->commit(
-        path    => File::Spec->catfile( $dir, $args{path} ),
-        comment => "set prop $args{type}"
-    );
-}
-
 =item check_repository
 
 Check if the given repository is valid.

Modified: Shipwright/trunk/lib/Shipwright/Script/Import.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Script/Import.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Script/Import.pm	Fri Jun 27 22:28:20 2008
@@ -296,7 +296,7 @@
     else {
         my ($name) = $source_dir =~ /([-\w.]+)$/;
         print "unknown build system for this dist; you MUST manually edit\n";
-        print "scripts/$name/build or provide a build.pl file or this dist\n";
+        print "/scripts/$name/build or provide a build.pl file or this dist\n";
         print "will not be built!\n";
         $self->log->warn("I have no idea how to build this distribution");
 
@@ -409,7 +409,7 @@
 The import command imports a new dist into a shipwright repository from any of
 a number of supported source types (enumerated below). If a dist of the name
 specified by C<--name> already exists in the repository, the old files for that
-dist in F<dists/> and F<scripts/> are deleted and new ones added. This is the
+dist in F</dists> and F</scripts> are deleted and new ones added. This is the
 recommended method for updating non-svn, svk, or CPAN dists to new versions
 (see L<Shipwright::Update> for more information on the C<update> command, which
 is used for updating svn, svk, and CPAN dists).



More information about the Bps-public-commit mailing list