[Bps-public-commit] r11061 - Shipwright/trunk/lib/Shipwright/Backend

sunnavy at bestpractical.com sunnavy at bestpractical.com
Thu Mar 13 10:53:15 EDT 2008


Author: sunnavy
Date: Thu Mar 13 10:53:02 2008
New Revision: 11061

Modified:
   Shipwright/trunk/lib/Shipwright/Backend/SVK.pm
   Shipwright/trunk/lib/Shipwright/Backend/SVN.pm

Log:
added flags sub for backend

Modified: Shipwright/trunk/lib/Shipwright/Backend/SVK.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Backend/SVK.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Backend/SVK.pm	Thu Mar 13 10:53:02 2008
@@ -60,6 +60,7 @@
         File::Spec->catfile( $dir, 'shipwright', 'order.yml' )  => 'null',
         File::Spec->catfile( $dir, 'shipwright', 'map.yml' )    => 'null',
         File::Spec->catfile( $dir, 'shipwright', 'source.yml' ) => 'null',
+        File::Spec->catfile( $dir, 'shipwright', 'flags.yml' ) => 'null',
     );
 
     for ( keys %map ) {
@@ -526,6 +527,42 @@
     return Shipwright::Util::Load($string) || {};
 }
 
+=head2 flags
+
+get or set flags
+
+=cut
+
+sub flags {
+    my $self   = shift;
+    my %args = @_;
+
+    croak "need dist arg" unless $args{dist};
+
+    if ($args{flags}) {
+        my $dir = tempdir( CLEANUP => 1 );
+        my $file = File::Spec->catfile( $dir, 'flags.yml' );
+
+        $self->checkout(
+            path   => '/shipwright/flags.yml',
+            target => $file,
+        );
+
+        my $flags = Shipwright::Util::LoadFile( $file );
+        $flags->{$args{dist}} = $args{flags};
+
+        Shipwright::Util::DumpFile( $file, $flags );
+        $self->commit( path => $file, comment => "set flags for $args{dist}" );
+        $self->checkout( detach => 1, target => $file );
+    }
+    else {
+        my ($out) = Shipwright::Util->run(
+            [ 'svk', 'cat', $self->repository . '/shipwright/flags.yml' ] );
+        $out = Shipwright::Util::Load($out) || {};
+        return $out->{$args{dist}} || []; 
+    }
+}
+
 1;
 
 __END__

Modified: Shipwright/trunk/lib/Shipwright/Backend/SVN.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Backend/SVN.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Backend/SVN.pm	Thu Mar 13 10:53:02 2008
@@ -60,6 +60,7 @@
         File::Spec->catfile( $dir, 'shipwright', 'order.yml' ) => 'null',
         File::Spec->catfile( $dir, 'shipwright', 'map.yml' )    => 'null',
         File::Spec->catfile( $dir, 'shipwright', 'source.yml' ) => 'null',
+        File::Spec->catfile( $dir, 'shipwright', 'flags.yml' ) => 'null',
     );
 
     for ( keys %map ) {
@@ -537,6 +538,41 @@
     return Shipwright::Util::Load($string) || {};
 }
 
+=head2 flags
+
+get or set flags
+
+=cut
+
+sub flags {
+    my $self   = shift;
+    my %args = @_;
+
+    croak "need dist arg" unless $args{dist};
+
+    if ($args{flags}) {
+        my $dir = tempdir( CLEANUP => 1 );
+        my $file = File::Spec->catfile( $dir, 'flags.yml' );
+
+        $self->checkout(
+            path   => '/shipwright',
+            target => $dir,
+        );
+
+        my $flags = Shipwright::Util::LoadFile( $file );
+        $flags->{$args{dist}} = $args{flags};
+
+        Shipwright::Util::DumpFile( $file, $flags );
+        $self->commit( path => $file, comment => "set flags for $args{dist}" );
+    }
+    else {
+        my ($out) = Shipwright::Util->run(
+            [ 'svn', 'cat', $self->repository . '/shipwright/flags.yml' ] );
+        $out = Shipwright::Util::Load($out) || {};
+        return $out->{$args{dist}} || []; 
+    }
+}
+
 1;
 
 __END__



More information about the Bps-public-commit mailing list