[Bps-public-commit] r13670 - in Shipwright/trunk: lib/Shipwright/Backend
sunnavy at bestpractical.com
sunnavy at bestpractical.com
Fri Jun 27 22:27:45 EDT 2008
Author: sunnavy
Date: Fri Jun 27 22:27:45 2008
New Revision: 13670
Modified:
Shipwright/trunk/ (props changed)
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
Log:
r13919 at sunnavys-mb: sunnavy | 2008-06-28 09:40:27 +0800
refactor test_script
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:27:45 2008
@@ -501,7 +501,25 @@
File::Spec->catfile( Shipwright::Util->share_root, $args{path} ) );
}
-#*_cmd = *test_script = *propset = *_subclass_method;
+=item test_script
+
+get or set test_script for a project, i.e. /t/test
+
+=cut
+
+sub test_script {
+ my $self = shift;
+ my %args = @_;
+
+ if ( $args{source} ) {
+ $self->_update_file( '/t/test', $args{source} );
+ }
+ else {
+ return $self->cat( path => '/t/test' );
+ }
+}
+
+#*_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:27:45 2008
@@ -139,23 +139,6 @@
}
}
-=item test_script
-
-Set test_script for a project, i.e. update the t/test script.
-
-=cut
-
-sub test_script {
- my $self = shift;
- my %args = @_;
- my $script = $args{source};
- croak 'need source option' unless $script;
-
- my $file = File::Spec->catfile( $self->repository, 't', 'test' );
-
- copy( $args{source}, $file );
-}
-
=item check_repository
Check if the given repository is valid.
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:27:45 2008
@@ -209,31 +209,6 @@
$self->log->warn($err) if $err;
}
-=item test_script
-
-Set test_script for a project, i.e. update the t/test script.
-
-=cut
-
-sub test_script {
- my $self = shift;
- my %args = @_;
- my $script = $args{source};
- croak 'need source option' unless $script;
-
- my $dir = tempdir( CLEANUP => 1 );
- my $file = File::Spec->catfile( $dir, 'test' );
-
- $self->checkout(
- path => '/t/test',
- target => $file,
- );
-
- copy( $args{source}, $file );
- $self->commit( path => $file, comment => "update test script" );
- $self->checkout( detach => 1, target => $file );
-}
-
=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:27:45 2008
@@ -230,31 +230,6 @@
);
}
-=item test_script
-
-Set test_script for a project, i.e. update the t/test script.
-
-=cut
-
-sub test_script {
- my $self = shift;
- my %args = @_;
- my $script = $args{source};
- croak 'need source option' unless $script;
-
- my $dir = tempdir( CLEANUP => 1 );
-
- $self->checkout(
- path => '/t',
- target => $dir,
- );
-
- my $file = File::Spec->catfile( $dir, 'test' );
-
- copy( $args{source}, $file );
- $self->commit( path => $file, comment => "update test script" );
-}
-
=item check_repository
Check if the given repository is valid.
@@ -283,9 +258,9 @@
my $path = shift;
my $latest = shift;
- if ( $path =~ m{(.*)/} ) {
- my $dir = tempdir( CLEANUP => 1 );
- my $file = File::Spec->catfile( $dir, $path );
+ if ( $path =~ m{(.*)/(.*)$} ) {
+ my $dir = tempdir( CLEANUP => 0 );
+ my $file = File::Spec->catfile( $dir, $2 );
$self->checkout(
path => $1,
More information about the Bps-public-commit
mailing list