[Bps-public-commit] r12261 -

sunnavy at bestpractical.com sunnavy at bestpractical.com
Mon May 12 12:06:48 EDT 2008


Author: sunnavy
Date: Mon May 12 12:06:47 2008
New Revision: 12261

Modified:
   /   (props changed)
   Shipwright/trunk/lib/Shipwright/Backend/SVK.pm
   Shipwright/trunk/lib/Shipwright/Backend/SVN.pm

Log:
 r12276 at sunnavys-mb:  sunnavy | 2008-05-12 23:17:23 +0800
 no versions method anymore, use version instead


Modified: Shipwright/trunk/lib/Shipwright/Backend/SVK.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Backend/SVK.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Backend/SVK.pm	Mon May 12 12:06:47 2008
@@ -95,10 +95,10 @@
                 $self->log->info(
                     "import $args{source} to " . $self->repository );
                 $self->_add_to_order($name);
-                $self->version(
-                    name    => $name,
-                    version => $args{version},
-                );
+
+                my $version = $self->version;
+                $version->{$name} = $args{version};
+                $self->version($version);
 
                 Shipwright::Util->run(
                     $self->_cmd( import => %args, name => $name ) );
@@ -501,7 +501,7 @@
 sub requires {
     my $self = shift;
     my %args = @_;
-    my $name = $args{$name};
+    my $name = $args{name};
 
     my ($string) = Shipwright::Util->run(
         [ 'svk', 'cat', $self->repository . "/scripts/$name/require.yml" ], 1 );
@@ -552,11 +552,9 @@
 
 sub version {
     my $self = shift;
-    my %args = @_;
-
-    croak "need name arg" unless $args{name};
+    my $version = shift;
 
-    if ( exists $args{version} ) {
+    if ( $version ) {
         my $dir = tempdir( CLEANUP => 1 );
         my $file = File::Spec->catfile( $dir, 'version.yml' );
 
@@ -565,39 +563,20 @@
             target => $file,
         );
 
-        my $version = Shipwright::Util::LoadFile($file);
-        $version->{ $args{name} } = $args{version};
-
         Shipwright::Util::DumpFile( $file, $version );
         $self->commit(
             path    => $file,
-            comment => "set version for $args{name}"
+            comment => 'set version',
         );
         $self->checkout( detach => 1, target => $file );
     }
     else {
         my ($out) = Shipwright::Util->run(
             [ 'svk', 'cat', $self->repository . '/shipwright/version.yml' ] );
-        $out = Shipwright::Util::Load($out) || {};
-        return $out->{ $args{name} };
+        return Shipwright::Util::Load($out) || {};
     }
 }
 
-=head2 versions
-
-get versions
-
-=cut
-
-sub versions {
-    my $self = shift;
-
-    my ($out) = Shipwright::Util->run(
-        [ 'svk', 'cat', $self->repository . '/shipwright/version.yml' ] );
-    $out = Shipwright::Util::Load($out) || {};
-    return $out;
-}
-
 =head2 check_repository
 
 =cut

Modified: Shipwright/trunk/lib/Shipwright/Backend/SVN.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Backend/SVN.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Backend/SVN.pm	Mon May 12 12:06:47 2008
@@ -104,10 +104,9 @@
                 $self->log->info(
                     "import $args{source} to " . $self->repository );
                 $self->_add_to_order($name);
-                $self->version(
-                    name    => $name,
-                    version => $args{version},
-                );
+                my $version = $self->version;
+                $version->{$name} = $args{version};
+                $self->version( $version );
 
                 Shipwright::Util->run(
                     $self->_cmd( import => %args, name => $name ) );
@@ -514,7 +513,8 @@
 
 sub requires {
     my $self = shift;
-    my $name = shift;
+    my %args = @_;
+    my $name = $args{name};
 
     my ($string) = Shipwright::Util->run(
         [ 'svn', 'cat', $self->repository . "/scripts/$name/require.yml" ], 1 );
@@ -564,11 +564,9 @@
 
 sub version {
     my $self = shift;
-    my %args = @_;
-
-    croak "need name arg" unless $args{name};
+    my $version = shift;
 
-    if ( exists $args{version} ) {
+    if ( $version ) {
         my $dir = tempdir( CLEANUP => 1 );
         my $file = File::Spec->catfile( $dir, 'version.yml' );
 
@@ -577,37 +575,20 @@
             target => $dir,
         );
 
-        my $version = Shipwright::Util::LoadFile($file);
-        $version->{ $args{name} } = $args{version};
-
         Shipwright::Util::DumpFile( $file, $version );
+
         $self->commit(
             path    => $file,
-            comment => "set version for $args{name}"
+            comment => 'set version',
         );
     }
     else {
         my ($out) = Shipwright::Util->run(
             [ 'svn', 'cat', $self->repository . '/shipwright/version.yml' ] );
-        $out = Shipwright::Util::Load($out) || {};
-        return $out->{ $args{version} };
+        return Shipwright::Util::Load($out) || {};
     }
 }
 
-=head2 versions
-
-get versions
-
-=cut
-
-sub versions {
-    my $self = shift;
-
-    my ($out) = Shipwright::Util->run(
-        [ 'svn', 'cat', $self->repository . '/shipwright/version.yml' ] );
-    $out = Shipwright::Util::Load($out) || {};
-    return $out;
-}
 
 =head2 check_repository
 



More information about the Bps-public-commit mailing list