[Bps-public-commit] r10800 - in Shipwright/lib/Shipwright: Backend

sunnavy at bestpractical.com sunnavy at bestpractical.com
Mon Feb 11 08:10:55 EST 2008


Author: sunnavy
Date: Mon Feb 11 08:09:33 2008
New Revision: 10800

Modified:
   Shipwright/lib/Shipwright/Backend/SVK.pm
   Shipwright/lib/Shipwright/Backend/SVN.pm
   Shipwright/lib/Shipwright/Source/CPAN.pm

Log:
refactor a bit for backend

Modified: Shipwright/lib/Shipwright/Backend/SVK.pm
==============================================================================
--- Shipwright/lib/Shipwright/Backend/SVK.pm	(original)
+++ Shipwright/lib/Shipwright/Backend/SVK.pm	Mon Feb 11 08:09:33 2008
@@ -4,7 +4,6 @@
 use strict;
 use Carp;
 use File::Spec;
-use CPAN::DistnameInfo;
 use Shipwright::Util;
 use File::Temp qw/tempdir/;
 use File::Copy;
@@ -101,8 +100,7 @@
     return unless @_;
     my %args = @_;
     my $name = $args{source};
-    $name =~ s{^.*/(.+)/?$}{$1.tar.gz};
-    $name = CPAN::DistnameInfo->new($name)->dist;
+    $name =~ s{.*/}{};
 
     unless ( $args{_initialize} || $args{_extra_tests} ) {
         if ( $args{build_script} ) {
@@ -129,7 +127,7 @@
                 $self->delete("dists/$name");
                 $self->log->info(
                     "import $args{source} to " . $self->repository );
-                $self->_add_to_order( source => $args{source} );
+                $self->_add_to_order($name);
                 Shipwright::Util->run(
                     $self->_cmd( import => %args, name => $name ) );
             }
@@ -279,15 +277,11 @@
 
 sub _add_to_order {
     my $self = shift;
-    my %args = @_;
-    my $name = $args{source};
+    my $name = shift;
 
     my $order = $self->order;
 
-    $name =~ s{^.*/(.+)/?$}{$1.tar.gz};
-    $name = CPAN::DistnameInfo->new($name)->dist;
-
-    unless ( grep { /^$name$/ } @$order ) {
+    unless ( grep { $name eq $_ } @$order ) {
         $self->log->info( "add $name to order for " . $self->repository );
         push @$order, $name;
         $self->order($order);
@@ -519,7 +513,6 @@
     $self->checkout( detach => 1, target => $file );
 }
 
-
 =head2 require
 return hashref to require.yml for a dist
 =cut
@@ -530,10 +523,9 @@
 
     my ($string) = Shipwright::Util->run(
         [ 'svk', 'cat', $self->repository . "/scripts/$name/require.yml" ], 1 );
-    return Shipwright::Util::Load( $string ) || {};
+    return Shipwright::Util::Load($string) || {};
 }
 
-
 1;
 
 __END__

Modified: Shipwright/lib/Shipwright/Backend/SVN.pm
==============================================================================
--- Shipwright/lib/Shipwright/Backend/SVN.pm	(original)
+++ Shipwright/lib/Shipwright/Backend/SVN.pm	Mon Feb 11 08:09:33 2008
@@ -4,7 +4,6 @@
 use strict;
 use Carp;
 use File::Spec;
-use CPAN::DistnameInfo;
 use Shipwright::Util;
 use File::Temp qw/tempdir/;
 use File::Copy;
@@ -100,8 +99,7 @@
     return unless @_;
     my %args = @_;
     my $name = $args{source};
-    $name =~ s{^.*/(.+)/?$}{$1.tar.gz};
-    $name = CPAN::DistnameInfo->new($name)->dist;
+    $name =~ s{.*/}{};
 
     unless ( $args{_initialize} ) {
         if ( $args{_extra_tests} ) {
@@ -134,7 +132,7 @@
                 $self->delete("dists/$name");
                 $self->log->info(
                     "import $args{source} to " . $self->repository );
-                $self->_add_to_order( source => $args{source} );
+                $self->_add_to_order( $name );
                 Shipwright::Util->run(
                     $self->_cmd( import => %args, name => $name ) );
             }
@@ -275,15 +273,11 @@
 
 sub _add_to_order {
     my $self = shift;
-    my %args = @_;
-    my $name = $args{source};
+    my $name = shift;
 
     my $order = $self->order;
 
-    $name =~ s{^.*/(.+)/?$}{$1.tar.gz};
-    $name = CPAN::DistnameInfo->new($name)->dist;
-
-    unless ( grep { /^$name$/ } @$order ) {
+    unless ( grep { $name eq $_ } @$order ) {
         $self->log->info( "add $name to order for " . $self->repository );
         push @$order, $name;
         $self->order($order);
@@ -538,7 +532,7 @@
 
     my ($string) = Shipwright::Util->run(
         [ 'svn', 'cat', $self->repository . "/scripts/$name/require.yml" ], 1 );
-    return Shipwright::Util::Load( $string ) || {};
+    return Shipwright::Util::Load($string) || {};
 }
 
 1;

Modified: Shipwright/lib/Shipwright/Source/CPAN.pm
==============================================================================
--- Shipwright/lib/Shipwright/Source/CPAN.pm	(original)
+++ Shipwright/lib/Shipwright/Source/CPAN.pm	Mon Feb 11 08:09:33 2008
@@ -11,6 +11,7 @@
 use File::Spec;
 use File::Slurp;
 use UNIVERSAL::require;
+use CPAN::DistnameInfo;
 
 use base qw/Shipwright::Source::Base/;
 



More information about the Bps-public-commit mailing list